Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6578ce9

Browse files
committedMar 1, 2011
makes the regular expression more flexible
1 parent 5b24344 commit 6578ce9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed
 

‎Resources/public/jquery/jquery.form.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ $.fn.ajaxSubmit = function(options) {
368368
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
369369
xhr.responseXML = toXml(xhr.responseText);
370370
}
371-
372371
data = httpData(xhr, s.dataType, s);
373372
}
374373
catch(e){
@@ -438,10 +437,10 @@ $.fn.ajaxSubmit = function(options) {
438437
// -- custom hack to make the ajax request works with non typed dataType
439438
// author : Thomas Rabaix <thomas.rabaix@sonata-project.org>
440439
// account for browsers injecting pre around json response
441-
var matches = xhr.responseText.match(/^(<pre>|<body>)(.*)(<\/pre>|<\/body>)$/);
440+
var matches = xhr.responseText.match(/^(<pre([^>]*)>|<body([^>]*)>)(.*)(<\/pre>|<\/body>)$/);
442441

443-
if(matches.length == 4){
444-
xhr.responseText = matches[2];
442+
if(matches && matches.length == 6){
443+
xhr.responseText = matches[4];
445444
}
446445

447446
if(xhr.responseText[0] == '{') {

0 commit comments

Comments
 (0)
Please sign in to comment.