mctrivia Posted February 16, 2011 Share Posted February 16, 2011 function getXMLHttp() { var xmlHttp try { //Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch(e) { //Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert("Your browser does not support AJAX!") return false; } } } return xmlHttp; } function MakeRequest() //$request1,$request2,...,$callback=null { $request="av0=" + escape(arguments[0]); var xmlHttp = getXMLHttp(); if (arguments.length > 1) { for ($i=1;$i<arguments.length-1;$i++) { $request=$request + "&av" + $i + "=" + escape(arguments[$i]); } if (arguments[arguments.length-1]==null) { xmlHttp.onreadystatechange = function () {}; } else { eval("xmlHttp.onreadystatechange = " + "function () { if (xmlHttp.readyState == 4) {" + arguments[arguments.length-1] + "(xmlHttp.responseText);}};"); } } else { xmlHttp.onreadystatechange = function () {}; } xmlHttp.open("POST", "ajax", true); xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlHttp.send($request); } The previous code is my AJAX script. I wrote it myself as a way to understand how it works and to deal with my sites strange structure. It works except when I pass a value to it with a + symbol the php sees this as a space probably because i use escape(arguments[$i]) to deal with the issue of some other special characters being in the input. Any ideas how to fix the script or process results in php so all characters can be passe? Quote Link to comment https://forums.phpfreaks.com/topic/227837-how-to-best-send-symbol/ Share on other sites More sharing options...
mctrivia Posted February 18, 2011 Author Share Posted February 18, 2011 problem solved. use encodeURIComponent instead of escape. Quote Link to comment https://forums.phpfreaks.com/topic/227837-how-to-best-send-symbol/#findComment-1175998 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.