Guest terjeto Posted October 10, 2006 Share Posted October 10, 2006 Whenever a XMLHTTP_request.send(<null for GET or string for POST>) is issued in the ajax JS function, I receive two requests in the webserver (seen in the apache logs). In addition to sending the POST/GET request to the webserver, the browser sends a _second_ request using (always) GET method.I've been pussled about this for a while, and did some researching. It turns out that for each ajax http request, Internet Explorer sends a second identical request using GET. Tagging the requests with a timestamp, reveals that both of the the requests are registered at the exact same time in the browser. On the other hand, In the apache log, the requests are set apart with approx 2-10 seconds.So if I for instance trigger this function (in e.g. an onclick event):(illustrated function) function send_ajax_post_request(a,b){ init(); if(!xmlHttp) {alert("No xmlHttp object!"); return; } var str = "a="+a+"&b="+b; var url = "myphpscript.php"; xmlHttp.open("POST", url, true); xmlHttp.onreadystatechange = callback_func; xmlHttp.send(str);} In the apache server I receive the request for myphpscript.php twice! One for POST method, and one for GET. This only happens using Internet Explorer.After browsing the internet for solutions, I tried a few tricks but failed.- The onclick event is not on a submit button which has its own default request built-in (E.g. it happens for all javascript events)- The "content advisor" in Internet Explorer is NOT turned ON- I disabled the IE caching using either a timestamp or using POST- Using Get instead of POST has the same problem.... resulting in two GET requests beeings sent.- I've tried setting different Request Headers but I'm not very familiar with this.I develop on plattform:Apach+php on Win32Any one seen this problem?EDIT: Found the problem. This is not an AJAX issue, but a PHP issue in the session_start(); Weird though that it is IE specific. Link to comment Share on other sites More sharing options...
jhecht Posted October 11, 2006 Share Posted October 11, 2006 IE is stupid... enough said. Link to comment Share on other sites More sharing options...
aspnetguy Posted October 11, 2006 Share Posted October 11, 2006 IE is stupid... enough said.If you are not going to help please don't spam with your opinions on IE. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now