Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stripped down version of jQuery for ajax/json functionality

Tags:

json

jquery

ajax

I like AJAX/JSON features of jQuery but the library is very big for blackberry phone development. Has anyone pulled out or developed a stand alone AJAX/JSON library similar to jQuery's? I know that a mobile version of jQuery is coming, but this looks like it is more directed at GUI for iPhone. I also tried XUI, but have been getting JavaScript errors when running in IE7.

like image 648
naimer Avatar asked Oct 24 '10 16:10

naimer


2 Answers

This is slightly tricky to accomplish. As lonesomeday has mentioned, that is one way. The other way is to write a small piece of code which uses all the functions you need from jQuery e.g. a dummy function with ajax calls and json etc.

Then put everything into a single JS file and run it through Google's Closure Compiler with Advanced Optimization.

like image 116
Alec Smart Avatar answered Sep 29 '22 11:09

Alec Smart


You can see the source files for jQuery on GitHub. It looks to me like you will need the following files to do AJAX, which you can probably compile and minify:

  • core.js
  • support.js
  • ajax.js
  • data.js
  • event.js

I haven't properly tested this yet, but it seems plausible that it should work. Whether it will actually be a significant performance benefit, I don't know.

Edit I've used the Google Closure Compiler to compile all these and minify them. The file can be seen on that site. It seems to work as far as I can tell, for a simple $.ajax call. Note that, as Nick says, all kinds of filtering functionality could be missing. Keep your usage of this simple and use at your own risk. Better, use a dedicated AJAX library.

like image 24
lonesomeday Avatar answered Sep 29 '22 11:09

lonesomeday