JQuery Ajax “uncaught typeerror: illegal invocation” refers to jQuery’s Ajax error: uncaught type error: illegal call
after checking jQuery’s document, it is found that if it is not a string, jQuery’s attempt to convert data into a string. Therefore, we need to add an option: processd ata:false Tell jQuery not to touch my data here! Another alternative is contentt ype:false To prevent jQuery from adding a content type header for you, otherwise the string will be lost and the upload will fail. The final Ajax code looks like this:
$.ajax({
url: url,
type: 'POST',
data: formdata,
contentType: false, //MUST
processData: false, //MUST
dataType: 'json',
success: callback
});
Similar Posts:
- [Solved] JS Ajax uploads an error “uncaught type error: illegal invocation”
- Uncaught typeerror: the solution of illegal invocation problem
- When parsing background JSON data with Ajax: unexpected token o in JSON at position 1
- [jQuery version] cannot read property ‘MSIE’ of undefined solution
- [Solved] Uncaught syntax error: invalid regular expression flags
- When using bootstrap modal box, uncaught typeerror: $(…). Modal is not a function
- JQuery Error: TypeError: jQuery.curCSS is not a function [How to Solve]
- Convert to IE9 below $. Ajax to return “no transport” across domains
- “bug” IE8 ajax 25253338169no transport
- [Solved] jQuery Error: Uncaught ReferenceError: $ is not defined