The validators complain about the ampersands; they say that the entities &title, &artists, &album, and &year are not valid. I tried replacing them with &title, etc. and that does fix the validation, but they no longer register as a parameters in the PHP script.
Any ideas?
(2) The PHP script returns some text that is inserted into a DIV on the page from XMLHttp.responseText, but it gets messed up if the returned text has UNICODE characters in it.
“Behind the view”? You didn’t put one behind the view either (and I’m pretty sure it isn’t necessary, possibly even incorrect).
In any case, I tried your code and it still doesn’t validate; it gives the same errors:
“Warning: cannot generate system identifier for general entity "title"”
“Error: general entity "title" not defined and no default entity”
“Error: reference to entity "title" for which no system identifier could be generated”
No. It is not incorrect. To separate parameters you must use &. When I said behind the view I was talking about...action=view. But I see that I wasn't looking far enough down the code.
Are you sure you have all the AJAX POST headers set up?
No. It is not incorrect. To separate parameters you must use &. When I said behind the view I was talking about...action=view. But I see that I wasn't looking far enough down the code.
Oh ok, I thought you meant ?action=view, which I’m fairly sure would be correct because ampersands separate parameters and you can’t put one before the first one.
Originally Posted by PeejAvery
Are you sure you have all the AJAX POST headers set up?
XMLHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
XMLHttp.setRequestHeader("Charset", "UTF-8"); //this was an attempt to fix problem (2); it didn’t help
The first line was all that’s listed in the AJAX texts I got it from.
Problem (1) isn’t an XMLHttpRequest problem anyway, it’s a markup problem. The XHTML validators complain about the presence of an ampersand in the string, but they are necessary to pass multiple parameters.
Also, any reason you set the open command to synchronous mode?
Problem (1) isn’t an XMLHttpRequest problem anyway, it’s a markup problem. The XHTML validators complain about the presence of an ampersand in the string, but they are necessary to pass multiple parameters.
Yes, the markup might be part of the problem, but you said that my example did not work either. That has no markup issues. Can you post the whole page's code?
Originally Posted by Synetech
Also, any reason you set the open command to synchronous mode?
That is just a snippet I had from another piece of code. I used synchronous for control purposes in that script.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Problem!!!</title>
<script type="text/JavaScript">
//validators complain about this, but you can’t replace the ampersands with &
var postparams="param1=value1¶m2=value2";
</script>
</head>
<body>
</body>
</html>
Yup, that worked. The “trick” was figuring out where to use it. Also, only part of it was fixed, but a quick test revealed that the part that still isn’t working is because somehow, the data was originally inserted into the database incorrectly (doesn’t really matter though since it was just a temp table for testing).
They both seem to be fixed now. Thanks.
However, it’s annoying that you can’t put any UNICODE characters in the HTML code or in JavaScript strings, you have to encode them which is not convenient.
Yup, that worked. The “trick” was figuring out where to use it. Also, only part of it was fixed, but a quick test revealed that the part that still isn’t working is because somehow, the data was originally inserted into the database incorrectly (doesn’t really matter though since it was just a temp table for testing).
They both seem to be fixed now. Thanks.
However, it’s annoying that you can’t put any UNICODE characters in the HTML code, you have to encode them.
Bookmarks