Tepu
Tepu

Reputation: 1702

Why does Jquery Ajax Post does an implicit Get?

I am doing simple page post using $.Ajax

Every time I post data I get response (html of the page) in success method and there is always a GET in fiddler. Why there is a GET there ? Should there be always a GET or am I missing something?

Below is my post request

 $.ajax({
           type: 'POST',           
           url: action,      
           data: $("#form").serialize(),      
           success: function (returnHtml) {
           alert(returnHtml);
           },
           error : function() {
           alert('error');
           },
           complete: function (html) {
           alert('complete');
           }
        });

thanks

Upvotes: 0

Views: 131

Answers (1)

Ehsan Sajjad
Ehsan Sajjad

Reputation: 62488

Actually when ajax call posts data, first it is POST, after that it gets the response from the server, whether its JSON or plain html.

This is the reason you are seeing Get in Fiddler.

Upvotes: 3

Related Questions