Q:

Making a button in the form have a different method for sending the data to the server

I have an html form and 2 buttons in it. The method of the form is post. However, I want to be able to send an get ajax request by clicking on the second button. But it sends a post request even though I set $.ajax({type: "GET"}).
I can't place the second button outside of the form because the layout won't look as I want: the second button will be placed on the next line.
So the bottom line is that I want the second button to be on the same line as the first one and to send a get ajax request.
How can I do that? I think that to rewrite post form method get would be easily.

A:

You need to remove the default post action assigned to the button before making the ajax request,
$("#button").click(function(event) {
     event.preventDefault();
     $.ajax({
        .....
        .....
     });
});

