Bài đăng

Đang hiển thị bài đăng từ tháng 6 3, 2015

How to Use jQuery’s $.ajax() Function theo http://www.sitepoint.com/

Without any doubt  Ajax  has taken web development by storm and it’s one of the most successful paradigms ever. In my article  An Introduction to jQuery’s Shorthand Ajax Methods , I discussed some of jQuery’s most used Ajax shorthand methods:  $.get() ,  $.post() , and  $.load() . They are convenient methods for making Ajax requests in a few lines of code. Sometimes, we need more control over the Ajax calls we want to make. For example, we want to specify what should happen in case an Ajax call fails or we need to perform an Ajax request but its result is only needed if retrieved within a certain amount of time. In such situations, we can rely on another function provided by jQuery, called  $.ajax() , that is the topic of this tutorial. The  $.ajax()  Function The jQuery’s  $.ajax()  function is used to perform an asynchronous HTTP request. It was added to the library a long time ago, existing since version 1.0. The  $.ajax()  function is what every function discussed in the pre