[英]JQuery form API throwing the error Unexpected token (
I'm using jquery and jquery form API for image upload with PHP, when I use callback anonymous functions for jquery form API it keep throwing me this error on every anonymous function, 我正在使用jquery和jquery表单API通过PHP上传图片,当我将回调匿名函数用于jquery表单API时,它会在每个匿名函数上不断抛出此错误,
Uncaught SyntaxError: Unexpected token (
未捕获到的SyntaxError:意外令牌(
I can't even use any other jquery function with this code also, maybe if I fix this error it'll work, 我什至无法在此代码中使用任何其他jquery函数,也许如果我修复此错误,它将起作用,
my code is 我的代码是
$(function() {
// bind 'myForm' and provide a simple callback function
$('#myForm').ajaxForm(function() {
beforeSend: function() {
alert('before send');
$('#form-asset-create').validate();
},
uploadProgress: function() {},
success: function() {},
compile: function() {}
});
$(".card").hide();
});
You should pass object literal with config options to ajaxForm
instead of a function. 您应该将带有配置选项的对象文字传递给
ajaxForm
而不是函数。
$(function() {
// bind 'myForm' and provide a simple callback function
$('#myForm').ajaxForm({
beforeSend: function() {
alert('before send');
$('#form-asset-create').validate();
},
uploadProgress: function() {},
success: function() {},
compile: function() {}
});
$(".card").hide();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.