S
Sean Kinsey
mandag 25. april 2011 kl. 03:42:22 UTC+2 skrev regman følgende:
A preflight OPTIONS call is executed to see what the server allows (typically happens with cross-domain requests).
Your php file clearly does not check the HTTP Verb (head, options, get, post) and runs its code on both requests.
Sean
Hi there,
I am very confused about my problem:
If I am using following code to send a HTTP request everything is fine:
req = new XMLHttpRequest();
req.open("GET", "http://.../test.php", false);
req.send(null);
The PHP script is just doing an insert into a DB like:
mysql_query("INSERT INTO tmp VALUES ('test')");
After sending the request the 'tmp' table has one entry filled with 'test'.
OK, but if I use the following code using the POST method:
req = new XMLHttpRequest();
req.open("POST", "http://.../test.php", false);
req.send("");
After that, the table 'tmp' has TWO entries called 'test'!?
What happens here?
If I look into my apache log, in the first case I see one line with ... GET ...
and in the second case I see also TWO entries, one with ... OPTIONS ... and one with ... POST ...
Does that have something to do with my problem? Or what is the reason of my problem in getting the SJAX call twice while using the POST method?
A preflight OPTIONS call is executed to see what the server allows (typically happens with cross-domain requests).
Your php file clearly does not check the HTTP Verb (head, options, get, post) and runs its code on both requests.
Sean