javascript - Jquery ajax returning 404 not found -
i'm using ajax pass form info , files php file processing.
javascript:
$("form#applyform").submit(function(){ var info = new formdata(); jquery.each($('#file')[0].files, function(i, file) { data.append('file-'+i, file); }); $.ajax({ url: 'validateapplication.php', data: data, cache: false, contenttype: false, processdata: false, type: 'post', success: function(data){ alert(data); } }); }
validateapplication.php
exists. can view if type in address web browser, when submit form chrome console returns 404.
the php in same folder html page javascript running on confused why maintain getting 404.
update
changing post gets rid of 404 error, returns 500 internal server error
update 2
changing action of form ="validateapplication.php" , submitting normal (without ajax) leads right file without errors.
it seemed problem formdata
object. 1 time changed method utilize .serialize()
instead, page worked fine.
$("form#applyform").submit(function(){ var info = $("form#applyform").serialize(); jquery.each($('#file')[0].files, function(i, file) { data.append('file-'+i, file); }); $.ajax({ url: 'validateapplication.php', data: data, cache: false, contenttype: false, processdata: false, type: 'post', success: function(data){ alert(data); } }); }
javascript php jquery ajax
No comments:
Post a Comment