jQuery: passing Ajax data

There is a big difference between the $.ajax() method and $.get() and $.post(). This method always expects that you pass data to the server along with your request. For example, this won't work:

$.ajax({
  type: 'GET',
  url: 'test.php',
  data: null,
  success: someMethod
});

If you want a simpler approach to Ajax, use the $.get() and $.post() methods for handling GET and POST requests, respectively.

Leave a Reply

Note: Only a member of this blog may post a comment.