javascript - $.post not working in ie. Alternative way help please? -


i used $.post send , receive response in web page. not working in internet explorer. used other way of ajax. have create xmlhttprequest object.

my code is

     var xmlhttp;      if (window.xmlhttprequest)        {// code ie7+, firefox, chrome, opera, safari        xmlhttp=new xmlhttprequest();        }      else        {// code ie6, ie5          xmlhttp=new activexobject("microsoft.xmlhttp");           }           xmlhttp.onreadystatechange=function()          {       if (xmlhttp.readystate==4 && xmlhttp.status==200)        {        document.getelementbyid("mydiv").innerhtml=xmlhttp.responsetext;         }       }      xmlhttp.open("post","demo_post2.asp",true);     xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded");       xmlhttp.send("fname=henry&lname=ford"); 

this works fine browser except ie-10. write code below support ie-10.

   if (window.xmlhttprequest)       {// code ie7+, firefox, chrome, opera, safari         xmlhttp=new activexobject("msxml2.xmlhttp.6.0");       } 

it not working mozila, safari working ie-10. have not checked ie-7. conflict. please provide me please...........

try going first approach , encapsule send function shownn below

settimeout(function () { xmlhttp.send(); }, 0); 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -