javascript - AJAX refreshing part of a page why is not working? -
i spent 2 days trying write allowed me upload file through ajax, close want do, can upload files through ajax, whole point of idea upload files without refreshing page, refreshing page , don´t know how solve it... current js
$('#profilovka').validate({ submithandler: function (form) { var aformdata = new formdata(); aformdata.append("subor", $('#subor').get(0).files[0]); $.ajax({ type: "post", url: "upravit.php", processdata: false, contenttype: false, data: aformdata, success: function (data) { $('#nove').load(document.url + ' #nove'); } }) } }); and form
<form class="profilovka" role="form" id="profilovka" method="post" enctype="multipart/form-data" > <tr> <td><label for="subor">nahraj profilovku:</label></td> <td><input type="file" name="subor" id="subor"></td> <td><button type="submit">save</button</td> </tr> </form> that line off code $('#nove').load(document.url + ' #nove'); should it, in different ajax methods works, thought mistake in form method , in have submit button there tried make button , give onclik="method()" , made js function method () { current js code can see } in case script doesnt anything... there simple way ? every help
you need add return false; submit handler automatic submit of form prevented.
Comments
Post a Comment