"notmodified" :
"success";
+ var errMsg;
+
if ( status === "success" ) {
// Watch for, and catch, XML document parse errors
try {
// process the data (runs the xml through httpData regardless of callback)
data = jQuery.httpData( xhr, s.dataType, s );
- } catch(e) {
+ } catch(err) {
status = "parsererror";
+ errMsg = err;
}
}
success();
}
} else {
- jQuery.handleError(s, xhr, status);
+ jQuery.handleError(s, xhr, status, errMsg);
}
// Fire the complete handlers
});
test("jQuery.ajax() - malformed JSON", function() {
- expect(1);
+ expect(2);
stop();
ok( false, "Success." );
start();
},
- error: function(xhr, msg) {
+ error: function(xhr, msg, detailedMsg) {
equals( "parsererror", msg, "A parse error occurred." );
+ ok( /^Invalid JSON/.test(detailedMsg), "Detailed parsererror message provided" );
start();
}
});