ajax simple example jquery
Example 1: ajax exmaple\
$.ajax({
url:'your url',
type: 'POST', // http method
data: { myData: 'This is my data.' }, // data to submit
success: function (data, status, xhr) { // after success your get data
$('p').append('status: ' + status + ', data: ' + data);
},
error: function (jqXhr, textStatus, errorMessage) { // if any error come then
$('p').append('Error' + errorMessage);
}
});
Example 2: difference between type and method in ajax
An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0.