1

Does Drupal support chunked AJAX responses in either direction?

I have not been able to find materials on this so far and am curious:

  1. Is Drupal AJAX capable of working with chunked AJAX responses (Does it have the functionality of waiting until all chunks are received and display them as soon as possible)
  2. Does Drupal have functionality to send Chunked responses to an AJAX request (Send data as soon as it's ready, so it can be displayed to the client)

What I mean by chunked AJAX is basically what multiple service booking sites do (example: airline tickets) They do multiple requests to different service providers and airlines, and results are displayed as soon as they're available and populated with more as they are sent.

2
  • Just to make sure I'm on the same page as you - do you mean "chunked" in the sense that the API requests are made on the back end (in PHP) in one long request, and each result is flushed back to the client immediately, before the next call is made (i.e. one AJAX call from the client)? Or do you mean you want to fire off multiple asynchronous requests from javascript, updating the DOM when each completes? Either way I don't think Drupal has anything specific that would help, but PHP and JS can both do it (maybe with a bit of server tweaking to allow in-request flushes)
    – Clive
    Commented Jun 8, 2016 at 19:23
  • @Clive: I mean the first one, where the PHP script in-turn makes multiple requests and returns the responses as "chunked" by flushing them back to the client immediately yes. Commented Jun 8, 2016 at 20:04

1 Answer 1

2

I don't think Drupal 7 or Drupal 8 support chunked AJAX response. Because AJAX in Drupal is implemented with jQuery.ajax which does not support that.

1
  • That's the saddest thing I've heard all day :( Guess it'll have to come from a custom module and a custom front-end script then.. THANKS! Commented Jun 9, 2016 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.