File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ if (!jQuery.support.cors && jQuery.ajaxTransport && window.XDomainRequest) {
55 var httpRegEx = / ^ h t t p s ? : \/ \/ / i;
66 var getOrPostRegEx = / ^ g e t | p o s t $ / i;
77 var sameSchemeRegEx = new RegExp ( '^' + location . protocol , 'i' ) ;
8+ var htmlRegEx = / t e x t \/ h t m l / i;
89 var jsonRegEx = / \/ j s o n / i;
910 var xmlRegEx = / \/ x m l / i;
1011
@@ -32,21 +33,18 @@ if (!jQuery.support.cors && jQuery.ajaxTransport && window.XDomainRequest) {
3233 var responses = {
3334 text : xdr . responseText
3435 } ;
35- /*
36- if (userType === 'html') {
37- responses.html = xdr.responseText;
38- } else
39- */
4036 try {
41- if ( ( userType === 'json' ) || ( ( userType !== 'text' ) && jsonRegEx . test ( xdr . contentType ) ) ) {
37+ if ( userType === 'html' || htmlRegEx . test ( xdr . contentType ) ) {
38+ responses . html = xdr . responseText ;
39+ } else if ( userType === 'json' || ( userType !== 'text' && jsonRegEx . test ( xdr . contentType ) ) ) {
4240 try {
4341 responses . json = jQuery . parseJSON ( xdr . responseText ) ;
4442 } catch ( e ) {
4543 status . code = 500 ;
4644 status . message = 'parseerror' ;
4745 //throw 'Invalid JSON: ' + xdr.responseText;
4846 }
49- } else if ( ( userType === 'xml' ) || ( ( userType !== 'text' ) && xmlRegEx . test ( xdr . contentType ) ) ) {
47+ } else if ( userType === 'xml' || ( userType !== 'text' && xmlRegEx . test ( xdr . contentType ) ) ) {
5048 var doc = new ActiveXObject ( 'Microsoft.XMLDOM' ) ;
5149 doc . async = false ;
5250 try {
You can’t perform that action at this time.
0 commit comments