Note that there are some explanatory texts on larger screens.

plurals
  1. POBackbone.js model fetch: parameters cause success/error/completed callbacks not to trigger
    primarykey
    data
    text
    <p>If I put the parameters in, I get no success/error/completed callbacks, but Fiddler shows a 200 response and my requested json data is there. <strong>That's the key. Fiddler is showing the round trip was a success and the requested data is here client side and in good order.</strong> Problem is backbone success/failure/completed not called. Just get a big nothing. </p> <p>With the exact same base URL, if I take the parameters out (and remove them from my web service in parallel), both success and completed are triggered. Below is my fetch "with" parameters:</p> <pre><code>myModel.fetch({ data: { name: 'Bob', userid: '1', usertype: 'new' } }, { success: (function () { alert(' Service request success: '); }), error: (function (e) { alert(' Service request failure: ' + e); }), complete: (function (e) { alert(' Service request completed '); }) }); </code></pre> <p>How can the backbone behavior be different? It's the same URL, just with or without parameters. </p> <p>I'm guessing the distinction is that under the hood in the backbone fetch, the "with" parameters scenario is a post and the "without" parameters is a simple get. The IE console reflects this with slightly different output.</p> <p>"With" parameters my IE browser console reports a warning (not an error but a warning) that the request required CORS:</p> <p>!SEC7118: XMLHttpRequest for <a href="http://example.com/service/myservice.asmx/myoperation?name=Bob&amp;userid=1&amp;usertype=new">http://example.com/service/myservice.asmx/myoperation?name=Bob&amp;userid=1&amp;usertype=new</a> required Cross Origin Resource Sharing (CORS).</p> <p>I think it's just telling me "hey, you made a cross origin request and I let it through". "Without" the parameters I don't get that warning. I do have the service headers set to:</p> <p>Access-Control-Allow-Origin: *</p> <p>And the responses do indeed come back reflecting that policy.</p> <p>So the question is why don't the backbone success/error/completed callbacks trigger "with" the parameters? The data makes it back. Shouldn't backbone reflect success?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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