Dojo.io.iframe.send does not send a request a second time in dojo 1.8

Code snippet example

this._deferred = dojo.io.iframe.send({ url: "/Some/Servie", method: "post", handleAs: 'html', content: {}, load: function(response, ioArgs){ //DO successfull callback }, error: function(response, ioArgs){ // DO Failer callback } }); 

Steps

  • press the submit button, send a request and successfully receive a response
  • press the submit button again ... the request never sends ...

Appreciate any help

+4
source share
3 answers

I can not speak for 1.8, but I use dojo 1.6 and had a very similar problem that I solved in the following way:

 dojo.io.iframe._currentDfd = null; //insert this line dojo.io.iframe.send ({... 

* Verified in Chrome version 25.0.1364.152 m

Source: http://mail.dojotoolkit.org/pipermail/dojo-interest/2012-May/066109.html

+2
source

dojo.io.frame.send will only send one request at a time, so if it considers that the first request is still being processed (whether it is actually or not), it will not work in the second call. The trick is to call cancel() on the returned deferred result if it exists, for example:

 if (this._deferred) { this._deferred.cancel(); } this._deferred = dojo.io.iframe.send({ .... 

which will cancel the first request and allow the second request to send it correctly.

+1
source

For dojo 1.8, dojo.io.iframe deprecated. Instead, dojo.request.iframe used.

And the solution from @ Sorry-Im-a-N00b still works:

 iframe._currentDfd = null; iframe.get(url, { data: sendData, }); 
0
source

All Articles