2015年5月4日 星期一

Jquery Deffer method

Introduction Basic content

Ajax: Asynchronous Java script and XML
JSON: Using string representation for an object 
jqXHR object:  is jquery XML HTTP object which represent as $.ajax
JSONP: Give a strategy to access cross domain data
 
                    Subject of Deffer function
Goal: 
It will let programmer make a asyn-like calling mechanism
and often use in nested ajax calling to avoid to nested content.

Event trigger:
In the process, declare the deffer start .deffer().
Then, you should write deffer.resolve() mean it success, or deffer.reject() mean fail in handle process.
Finally, you return it by .promise();

Event Handle:
Client code can handle it by .then(callback1, [callback2]) method after it use the Event trigger method,


Ref:
ajax-deferreds tutorial
jquery deferred-object function
jquery-deferred-object chinese








沒有留言:

張貼留言