I have such jQuery code:
$(document).ready(function() {
$('.btn-create-post-card').on('click', function(event) {
event.preventDefault();
let form_data = new FormData(),
file = $('.input_file_button');
// if(!file.val()) {
// alert('Please select postcard you want to send')
// }
form_data.append("file", file.prop('files')[0]);
$.ajax({
url: "/sendEmail",
dataType: 'multipart/form-data',
cache: false,
contentType: false,
processData: false,
data: form_data,
type: 'post',
success: function(data) {
alert('OK');
},
error: function(error, status) {
console.log('here');
console.log(error);
alert(error);
}
});
});
});
And I'm getting error:
TypeError: 'caller', 'callee', and 'arguments' properties may not be
accessed on strict mode functions or the arguments objects for calls
to them
at Function.remoteFunction (:2:14)
Console output is:
As you can see response is successful and I used jQuery AJAX calls a lot before and never had such issue.
Updated:
console output:
abort: ? (e)
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 1
name: "abort"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
always: ? ()
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 0
name: "always"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
catch: ? (e)
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 1
name: "catch"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
done: ? ()
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 0
name: "add"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
fail: ? ()
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 0
name: "add"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
getAllResponseHeaders: ? ()
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 0
name: "getAllResponseHeaders"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
getResponseHeader: ? (e)
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 1
name: "getResponseHeader"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
overrideMimeType: ? (e)
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 1
name: "overrideMimeType"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
pipe: ? ()
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 0
name: "pipe"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
progress: ? ()
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 0
name: "add"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
promise: ? (e)
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 1
name: "promise"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
readyState: 4
responseText: ""can't upload file""
setRequestHeader: ? (e,t)
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 2
name: "setRequestHeader"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
state: ? ()
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 0
name: "state"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
status: 200
statusCode: ? (e)
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 1
name: "statusCode"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
statusText: "OK"
then: ? (t,r,i)
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)]
length: 3
name: "then"
prototype: {constructor: ?}
__proto__: ? ()
[[FunctionLocation]]: jquery.min.js:2
[[Scopes]]: Scopes[3]
__proto__: Object
See Question&Answers more detail:
os