Reputation: 2332
I have a html form and validated it using jquery bassitance plugin, then after validation, I am trying to submit the data to a remote script(a script located on my different site) to insert into database. When I do this, I can see that in firebug it says "301 moved permanently and it never insert into database.
jQuery.ajax({
type: "POST",
url: "http://www.abc.com/insert.php",
data: "fname="+ fname
please advise what could be the reason.
regards
Upvotes: 0
Views: 472
Reputation: 14814
Read here: http://bugs.jquery.com/ticket/3932
If a jQuery AJAX POST hits a redirect (like HTTP 301), jQuery will not automatically rePOST to the new location. I'd recommend updating your AJAX to POST to the new URL.
Upvotes: 1
Reputation: 1979
There is some information here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
BlockquoteIf the 301 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.
Note: When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request.
Upvotes: 0