开发者

What is good javascript ajax library for a custom library?

A little explanation: I'm building a library to handle some back and forth with our CMS and have decided to open source it. Right now I have a dependency on jQuery 1.5 for it's AJAX method, specifically the recently added statusCode object. This is the only depency, and I'm not expe开发者_开发技巧cting others.

Are there any lightweight AJAX only libraries out there capable of this functionality? I'd rather not include all of jQuery if necessary.


Look at ender. Which allows you to include only what you want. I believe the ajax library included is very small.

You should avoid Single points of failure like having other services host code for you.


Just get those codes:

  • https://github.com/jquery/jquery/blob/master/src/intro.js

  • https://github.com/jquery/jquery/blob/master/src/core.js

  • https://github.com/jquery/jquery/blob/master/src/ajax.js

  • https://github.com/jquery/jquery/tree/master/src/ajax (get the files depending on what methods you use)

  • https://github.com/jquery/jquery/blob/master/src/outro.js

And gather them in a single file. It should work.


Why not call jQuery directly from google. Since most users use google, many will already have jQuery cached and will not have the need to reload jQuery when accessing your site.

<script src=" http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>

Check out this blog 3 reasons why you should let google host your jQuery. http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/


I like Mochikit, but it does more that just AJAX, but has a better async handling method using the Deferred object. It is smaller than Jquery.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜