woolyg Posted December 13, 2007 Share Posted December 13, 2007 Hi all, I have a piece of code in a file called sajax.php: if(!A && typeof XMLHttpRequest != "undefined") It all works fine, but when I go about debugging and attempting to make the page XHTML-compliant, the '&&' bit gets caught out. If I replace them with & in each case, the PHP document ceases to function, so I have to revert back to '&&' to get it going again. I have added the following to my php.ini file on the server: arg_separator.output = "&" arg_separator.input = "&" ..but it makes no difference. Is there a different way of escaping ampersands so the XHTML inspector will allow them, and for my AJAX to still work? All help much appreciated. WoolyG Link to comment https://forums.phpfreaks.com/topic/81571-escaping-ampersands/ Share on other sites More sharing options...
sKunKbad Posted December 26, 2007 Share Posted December 26, 2007 try commenting the javascript <!-- javascript --> and or using cdata declaration Link to comment https://forums.phpfreaks.com/topic/81571-escaping-ampersands/#findComment-423118 Share on other sites More sharing options...
jos. Posted December 27, 2007 Share Posted December 27, 2007 <script language="JavaScript" type="text/javascript"> /*<![CDATA[*/ /*]]>*/ </script> is the syntax for the CDATA... also you might try separating your javaScript and HTML by putting your javascript in an external file and referencing it : <script type="text/javascript" src="external_javascript_file_name.js"></script> Jos. Link to comment https://forums.phpfreaks.com/topic/81571-escaping-ampersands/#findComment-424367 Share on other sites More sharing options...
woolyg Posted January 3, 2008 Author Share Posted January 3, 2008 OK, COol, thank you for your reply Jos - Woolyg Link to comment https://forums.phpfreaks.com/topic/81571-escaping-ampersands/#findComment-429688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.