diff --git a/jquery.iecors.js b/jquery.iecors.js index 3c9d418..9bd3554 100755 --- a/jquery.iecors.js +++ b/jquery.iecors.js @@ -23,12 +23,11 @@ var headers = { 'Content-Type': xdr.contentType }; complete(200, 'OK', { text: xdr.responseText }, headers); }; - + // Apply custom fields if provided - if ( s.xhrFields ) { - xhr.onerror = s.xhrFields.error; - xhr.ontimeout = s.xhrFields.timeout; - } + if ( s.xdrFields ) { + $.extend(xdr, s.xdrFields); + } xdr.open( s.type, s.url );