admin管理员组文章数量:1325236
I'm trying to upload an image with jquery $.ajax method. I have been using the $.ajax code since many years, but strangely it is not working on this particular project. Here is the code
<form id="adimgform">
<input type="file" id="adimage" name="adimage" accept="image/png, image/gif, image/jpeg, image/webp" required>
</form>
Javascript code
$('#adimage').change(function(){
uploadimage();
});
function uploadimage()
{
const adimgform = new FormData($('#adimgform')[0]);
$.ajax({
url: '/controller/upload-ad-image.php',
type : 'POST',
async: true,
cache: false,
contentType: false,
processData: false,
data: adimgform,
enctype: 'multipart/form-data',
success: function (returndata) {
$('#adform1result').html(returndata);
}
});
}
And this is the error im getting
Uncaught SyntaxError: Failed to execute 'appendChild' on 'Node': missing ) after argument list
at m (jquery-3.7.1.min.js:2:880)
at $e (jquery-3.7.1.min.js:2:46274)
at ce.append (jquery-3.7.1.min.js:2:47633)
at ce.<anonymous> (jquery-3.7.1.min.js:2:48729)
at M (jquery-3.7.1.min.js:2:29497)
at ce.html (jquery-3.7.1.min.js:2:48405)
at Object.success (post-now.php?category=1&name=Automobiles:220:41)
at c (jquery-3.7.1.min.js:2:25304)
at Object.fireWith [as resolveWith] (jquery-3.7.1.min.js:2:26053)
at l (jquery-3.7.1.min.js:2:77782)
strangely, all other forms are working on this site, so im really confused. Any help would be much appreciated, please.
本文标签:
版权声明:本文标题:javascript - Uncaught SyntaxError: Failed to execute 'appendChild' on 'Node': missing ) after ar 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742169128a2426386.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论