What is the difference between $.get(), $.post() and $.ajax() in jQuery?
| Method | Use |
|---|---|
$.get(url, data, fn) | Quick GET request |
$.post(url, data, fn) | Quick POST request |
$.getJSON(url, fn) | GET request which expects JSON |
$.ajax({...}) | Any method (PUT, DELETE), headers, timeout, content type and more |
See jQuery Ajax.
Learn more about the similar topics:
| Tutorials |
|---|
| jQuery load() Method |
| jQuery Ajax: ajax(), get(), post() and getJSON() |
| jQuery Deferred, Promises and $.when() |
| Exercises & Assignments |
|---|
| Write jQuery code to load JSON data with Ajax and show it in a list |
| Write jQuery code to submit a form with Ajax |