Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery like standalone ajax library [closed]

I was working on a javascript project using jQuery 2.1.0 for ajax request (among other things) and now I need to get rid of the jQuery dependency.

To keep this change as simple as possible I need to find a light-standalone library that provides an ajax abstraction layer (just ajax if it's possible) maintaining the exact same jQuery 2.1.0 ajax interface. I specially need that the request returns the same promise as jQuery would do.

I've tried jQuery custom builds and Zepto custom builds, but they are still too heavy for just having an ajax abstraction layer.

like image 559
Augusto Altman Quaranta Avatar asked Dec 06 '25 07:12

Augusto Altman Quaranta


1 Answers

You can use jQLite which contains an ajax function, only weights 16k so is very light and shouldn't be a problem.

Also once you add the script of jQLite, it checks if there is already a jQuery version, in that case doesn't override the $ global variable name

Update

PD: you can implement your own function for AJAX request using this code for example, and providing a simple interface of the request, method and callback/errback of the request depends of how critical is for the weight of the library, however using CDN libraries your page should'n get any slower

like image 103
Matias Fernandez Martinez Avatar answered Dec 08 '25 21:12

Matias Fernandez Martinez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!