First of all, I kept all my magic as a call from the success function but I After realizing the call, did (...) add (and I believe there is also an ready ). Could Business be Magic? I do not know what is the "correct way", but most of what I have seen It is advisable to use In other words, it is easy to read: To read it: To read it: < Pre> (In fact, it would be better for the names of your business logic (and all ) names like
$ Ajax ({url: "http: // ...", data type: 'jsonp', success: work () {doMagic (1);}, ready: function () {doMagic (2);}, .. .}) Done (function () {doMagic (3);});
.done (...) because it is clean and easy to read because the reason for the actual code is between the block of code
success takes the actual AJAX call to the function.
$ Ajax ({url: "http: // ...", data type: 'jsonp', ...}) done (function (data) {// some very long function here}} < / Pre>
$. Ajax ({url: "http: // ...", Data type: 'jsonp', success: function (data) ) {// here is a very long function}, ...}); It is said that if the function actually being said is really something important (i.e. just by dumping the result in some HTML element), I use a named function and its number From here, and in that case I think it will be easy to read:
function onsutus (data) {// some very long work here} $ .ajax ( {Url: "http: // ...", Datatype: 'JasonP', success: onsut, ...});
$. Ajax ({url: "http: // ...", data type: 'jsonp', ..}} done (onsut);
Business.Model.OnSuccess , but Anne left him because it is not really part of the North)
No comments:
Post a Comment