views:

109

answers:

5

Hi im working on an ajax shopping cart using php and javascript with the jQuery library. Does anyone have any tips in speeding up the ajax requests.

Also, are there any best practices with regards to locking the shopping basket or options to add more items with the request is taking place?

A: 

I think the only thing anyone can recommend is that you optimize your code, both front and back end. Make sure you don't have any unnecessary code etc.

MoDFoX
+1  A: 

Prefer JSON over XML for data transfer just due to the reduced bloat XML gives you (closing tags). XML definitely has its uses - just be judicious when you use one over the other.

David Hoerster
A: 

It's possible to cache ajax content. It will speed up your page.

Topera
A: 

You can setup in JQuery.ajax( settings ) client side caching. You can also do server side caching, but client side could be better solution in situations such as yours. If I remember correctly caching is on by default.

aromawebdesign.com
A: 

Make sure you gzip what's being returned from the ajax requests, if you're not already.

Add this to your php files ob_start("ob_gzhandler");

Emmanuel