Note that there are some explanatory texts on larger screens.

plurals
  1. POreceiving async POST response, need to update webpage
    text
    copied!<p>So I am displaying a web page using the django framework. Now, I get asynchronous POST responses from the foursquare API when ever someone checks in to one of my locations.</p> <p>This is kind of an odd problem.</p> <p>My question: What would be the best way to update the webpage, without refreshing it, whenever my server receives a POST response from the foursquare API servers. For now, in the view for handling the POST response, I just update some context variables and use those variables in another view to display stuff, but obviously the changes show only after refreshing the page.</p> <p>I have looked into AJAX and understand that it is useful when client is aware of some event happening, which then makes a call to a function to receive some values and update part of a page like some div.</p> <p>But in my case the client is not aware of any such event since the request is getting generate when someone checks in and the response is coming from the foursquare servers to my server.</p> <p>I there some way to deal with this? I have looked into dajax and dajaxice, but couldn't find how they could be useful.</p> <p>I have seen some solutions in which I could add some JQuery to query the server at small regular intervals, but that does not seem optimal.</p> <p>Any suggestions on what I should look into?</p> <p>Turns out, web socket wont cut it, since I do not have any events occurring at the client side and I do not need full duplex communication; and Comet seems to be a heavy framework.I am looking into other stuff. Open to cool suggestion.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload