git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3740716
)
Added support for parsererror errors from Ajax requests (bug #1145).
author
John Resig
<jeresig@gmail.com>
Sat, 21 Jul 2007 00:52:30 +0000
(
00:52
+0000)
committer
John Resig
<jeresig@gmail.com>
Sat, 21 Jul 2007 00:52:30 +0000
(
00:52
+0000)
src/ajax/ajax.js
patch
|
blob
|
history
diff --git
a/src/ajax/ajax.js
b/src/ajax/ajax.js
index
4b1e9b0
..
7d83a0e
100644
(file)
--- a/
src/ajax/ajax.js
+++ b/
src/ajax/ajax.js
@@
-662,7
+662,7
@@
jQuery.extend({
} else
jQuery.handleError(s, xml, status);
} catch(e) {
} else
jQuery.handleError(s, xml, status);
} catch(e) {
- status = "error";
+ status = "parsererror";
jQuery.handleError(s, xml, status, e);
}
jQuery.handleError(s, xml, status, e);
}
@@
-757,8
+757,11
@@
jQuery.extend({
*/
httpData: function( r, type ) {
var ct = r.getResponseHeader("content-type");
*/
httpData: function( r, type ) {
var ct = r.getResponseHeader("content-type");
- var data = !type && ct && ct.indexOf("xml") >= 0;
- data = type == "xml" || data ? r.responseXML : r.responseText;
+ var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
+ data = xml ? r.responseXML : r.responseText;
+
+ if ( xml && data.documentElement.tagName == "parsererror" )
+ throw "parsererror";
// If the type is "script", eval it in global context
if ( type == "script" )
// If the type is "script", eval it in global context
if ( type == "script" )