我使用的是 jquery.form 插件,它工作正常,但是当更改输入值时.. 它提交得很好!但是将我重定向到我的 uploader.php 文件,我不想重定向我,我需要在 div.result 中获得结果,
要了解我,请查看我的代码:
HTML
<form id="uploader" action="uploader.php" method="post" enctype="multipart/form-data">
<input id="file" type="file" name="uploader" value="" draggable="true">
<input name="submit" type="submit" class="submit" value="Upload">
<div class="result"></div>
</form>
uploader.php 文件:
<?php
if( isset($_POST['submit']) and $_SERVER['REQUEST_METHOD'] == "POST" ){
echo 'done!';
}
?>
jQuery代码:
jQuery(document).ready(function() {
$('#uploader').change(function(){
$(".result").html('');
$(".result").html('wait..');
$("#uploader").ajaxForm({
target: '.result',
success: function()
{
$('.result').hide().slideDown('fast');
$('#uploader')[0].reset();
},
});
});
});
我需要在 .result div 中回显“完成”,我不想将我重定向到 uploader.php 页面。