diff options
| author | Misko Hevery | 2011-02-03 12:55:23 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-02-03 20:03:32 -0800 |
| commit | d35c1ac8b0bcd5df7a978fa2baee40be7ee317f3 (patch) | |
| tree | 8645986434661680371ad43eb160e8f4718b66e9 /src/Browser.js | |
| parent | 2a9f7b7287d622c17fd030eb5dfc9787cf5e6087 (diff) | |
| download | angular.js-d35c1ac8b0bcd5df7a978fa2baee40be7ee317f3.tar.bz2 | |
Fixed notifyWhenNoOutstandingRequests() when using JSONP
Diffstat (limited to 'src/Browser.js')
| -rw-r--r-- | src/Browser.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Browser.js b/src/Browser.js index 85bfb304..bc278b28 100644 --- a/src/Browser.js +++ b/src/Browser.js @@ -81,6 +81,7 @@ function Browser(window, document, body, XHR, $log) { callback = post; post = _null; } + outstandingRequestCount ++; if (lowercase(method) == 'json') { var callbackId = "angular_" + Math.random() + '_' + (idCounter++); callbackId = callbackId.replace(/\d\./, ''); @@ -89,7 +90,7 @@ function Browser(window, document, body, XHR, $log) { script.src = url.replace('JSON_CALLBACK', callbackId); window[callbackId] = function(data){ window[callbackId] = _undefined; - callback(200, data); + completeOutstandingRequest(callback, 200, data); }; body.append(script); } else { @@ -98,7 +99,6 @@ function Browser(window, document, body, XHR, $log) { xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Accept", "application/json, text/plain, */*"); xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - outstandingRequestCount ++; xhr.onreadystatechange = function() { if (xhr.readyState == 4) { completeOutstandingRequest(callback, xhr.status || 200, xhr.responseText); @@ -248,7 +248,7 @@ function Browser(window, document, body, XHR, $log) { }); } return listener; - } + }; ////////////////////////////////////////////////////////////// // Cookies API |
