0

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

1
  • 1
    Bear in mind you are not allowed to make AJAX which don't originate from the same domain/protocol. Search: same origin policy Commented Mar 14, 2012 at 13:41

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks, good to know this but I don't think that has a solution. Is it even possible to use remote url or not? also, what you mean by updating my AJAX? please clarify..
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.