Not able to send POST request through jQuery Ajax
Posted
by Amit
on Stack Overflow
See other posts from Stack Overflow
or by Amit
Published on 2010-05-12T07:20:09Z
Indexed on
2010/05/12
7:24 UTC
Read the original article
Hit count: 246
jquery-ajax
Hi,
I was trying to send an ajax request as POST request. But when i verified it on httpFox on firefox, the request is sent as GET. I tried pbht $.ajax() and $.post().
Many had a query regarding the same and had missed the "type" in $.ajax(), but even if i mention the type as "POST", the request will be of type GET. Here is my code:
$('.test').click(function(){
alert("clicked");
$.ajax({
type: "POST",
url: "www.testsite.com",
data: "name=John&location=Boston",
success: function(msg){
alert( "Data Saved: " + msg );
}
});
});
Any idea why it happens?
© Stack Overflow or respective owner