jchoi1009 Posted June 4, 2009 Share Posted June 4, 2009 I have this simple code to test something: <?php if (isset($_POST['c'])){ echo $_POST["c"]; return; } ?> <html> <head> <script type="text/javascript"> <!-- function ajax(){ var activexmodes=["Microsoft.XMLHTTP","Msxml2.XMLHTTP"]; //activeX versions to check for in IE if (navigator.appName == "Microsoft Internet Explorer" && window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken) for (var i=0; i<activexmodes.length; i++){ try{ return new ActiveXObject(activexmodes[i]); } catch(e){ //suppress error } } } else if (window.XMLHttpRequest) // if Mozilla, Safari etc return new XMLHttpRequest(); else return; } function sendIt(){ var xml = new ajax(); var params = "c="+encodeURI(document.getElementById("c").value); xml.open("POST", "test.php", true); xml.setRequestHeader("If-Modified-Since", "Fri, 31 Dec 1999 23:59:59 GMT"); xml.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xml.setRequestHeader("Content-length", params.length); xml.setRequestHeader("Connection", "close"); xml.onreadystatechange = function(){ if (xml.readyState == 4){ document.getElementById('r').innerHTML = xml.responseText; } }; xml.send(params); } //--> </script> </head> <body> <div id="r" style="font-size:15pt"> HERE </div> <input type="text" id="c" /> <input type="button" value="Submit" onclick="sendIt()" /> </body> </html> It works flawlessly on Firefox, but on IE, the php is not receiving any parameter ($_POST['c'] is empty always). I tried both POST and GET methods. Please help me. Much appreaciated. Link to comment https://forums.phpfreaks.com/topic/160943-ajax-parameter-passing-not-working-on-ie/ Share on other sites More sharing options...
rv20 Posted June 4, 2009 Share Posted June 4, 2009 Works for me on IE6 Link to comment https://forums.phpfreaks.com/topic/160943-ajax-parameter-passing-not-working-on-ie/#findComment-849465 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.