sijax-python icon indicating copy to clipboard operation
sijax-python copied to clipboard

Can I return data to my JS using sijax?

Open coreybrett opened this issue 10 years ago • 3 comments

In other words, could I generate some data in a sijax handler and return that data to the JS script that called the handler?

coreybrett avatar Jun 25 '15 23:06 coreybrett

As of the moment, no. When the response arrives to the browser, we don't know which part of the code made the request and we can't return control there, nor pass any data to it.

I guess you could simulate something like this yourself though.. Saving some state (request id, callback, ..) somewhere before doing the actual Sijax.request(). Then your server response could schedule some custom javascript code to run by calling obj_response.script("...."). This code could make use of the state you've saved and run whatever you want it to run.

spantaleev avatar Aug 04 '15 21:08 spantaleev

Is it something that is planned?

numkem avatar Sep 23 '15 16:09 numkem

No new features are planned or being worked on. But if you have an idea about a good way to implement this, why not.

spantaleev avatar Sep 23 '15 23:09 spantaleev