views:

130

answers:

2

My ajax responses seem to die out now that I am sending so much data in response to a search form request. I'm using Django with Apache and Firefox and Chrome noth die out if I don't limit my search to few enough results. What's the time or size limit to an Ajax response?

A: 

There's no specific limit relating to AJAX. However, if you have a lot of data which you are generating, a browser will timeout if you wait to massage all of the data into a suitable form (whether JSON, XML or HTML) before sending it all out. If you are using an auto-complete type query, generally it's enough to limit the matching entries to around a dozen. If it's a more conventional search, you can use pagination for the results page. Alternatively you might need to use a generator-like approach for page generation, though that might make setting a Content-Length header a little challenging.

Vinay Sajip
A: 

For a search page, do django-pagination with infinite scroll.

Paul Tarjan