amilaik Posted January 30, 2011 Share Posted January 30, 2011 I have an Ajax code inside my Php and it works smoothly in Chrome but not in IE HELP HELP HELP !!!! code is ; function ajaxRequest(){ var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE if (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) } catch(e){ //suppress error } } } else if (window.XMLHttpRequest) // if Mozilla, Safari etc return new XMLHttpRequest() else return false } function getajax() { var mypostrequest=new ajaxRequest() mypostrequest.onreadystatechange=function(){ if (mypostrequest.readyState==4){ if (mypostrequest.status==200 || window.location.href.indexOf("http")==-1){ document.getElementById("content").innerHTML=mypostrequest.responseText } else{ alert("An error has occured making the request") } } } var pinval = encodeURIComponent(document.getElementById("pin").value) var fval = encodeURIComponent(document.getElementById("func").value) var parameters="cid="+pinval+"&f="+fval mypostrequest.open("POST", "forecast.inc.php", true) mypostrequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded") mypostrequest.send(parameters) } Link to comment https://forums.phpfreaks.com/topic/226126-ajax-request-not-working-in-ie/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.