spantaleev / sijax-python

An easy to use AJAX library for Python based on jQuery.ajax

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can I return data to my JS using sijax?

coreybrett opened this issue · 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?

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.

Is it something that is planned?

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