Note that there are some explanatory texts on larger screens.

plurals
  1. POIE9 Jquery backbone fetch does not work
    text
    copied!<p>I have a fully functional backbone js application. In my controller, I retrieve my model from api through chained when.apply function calls. For example, </p> <pre><code> $.when.apply($, [&lt;&lt;array of deferred async calls&gt;&gt;]).done(function () { &lt;&lt;Code to be executed after all deferred calls complete&gt;&gt; }); </code></pre> <p>This code has been working in latest firefox, chrome and IE10 browsers, but not in IE9. IE9 has not thrown any errors, but I see no calls made for loading the model data in network tab. Therefore the code to be executed after the call completes are not hit as well. </p> <p>When searching for this issue I ran into this post. <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply</a> The post says, </p> <blockquote> <p>Note: Most browsers, including Chrome 14 and Internet Explorer 9, still do not accept array-like objects and will throw an exception.</p> </blockquote> <p>Is there a way around this without overhauling my existing code, which is a lot?</p> <p>EDIT: After @Beetroot's comment below, it seems like backbone's fetch is to blame, which is used within the when.apply. </p> <pre><code> r = { method: 'get', body: { userId: loggedInUser } }; $.when.apply($, [employee.fetch(r), department.fetch(r)]).done(function () { &lt;&lt;Code to be executed after all deferred calls complete&gt;&gt; }); </code></pre> <p>Again, when researching this issue, there are posts in SO like <a href="https://stackoverflow.com/questions/16240932/backbone-fetch-fails-for-ie">Backbone fetch() fails for IE</a>, that suggest changing the fetch function to make it work in IE9. As mentioned above, we have hundreds of fetches in our application currently and it will set us back significantly if I have to rewrite these fetches. Is there any other way to fix this issue? </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