任何人都可以看到为什么这个表单以正常方式提交并且没有被 jQuery submit() 捕获,我在控制台中没有收到任何错误。
<script charset="utf-8">
$("#theform").submit(function(event) {
$.post('./index.php',{INPUT: $("#INPUT").val(),
TO_TYPE: $("#TO_TYPE").val(),
TO_V_BITRATE: $("#TO_V_BITRATE").val(),
TO_A_BITRATE: $("#TO_A_BITRATE").val()},
function(data) {
$('#divResult').replaceWith('<div id="divResult">'+ data.result +'<div>');
});
event.preventDefault();
return false;
});
</script>
<h1>FFmpeg</h1>
<form id="theform" action="" method="POST">
<p>Input file:
<select size="1" id="INPUT" name="INPUT">
<option value="demo.mp4">demo.mp4</option>
</select>
</p>
<p>Convert To:
<select size="1" id="TO_TYPE" name="TO_TYPE">
<option value="AVI">AVI</option>
<option selected value="MP4">MP4 (x264)</option>
<option value="FLV">Flash</option>
</select>
Video Bitrate:
<select size="1" id="TO_V_BITRATE" name="TO_V_BITRATE">
<option value="96">96</option>
<option value="192">192</option>
<option value="288">288</option>
<option value="384">384</option>
...
</select>
Audio Bitrate:
<select size="1" id="TO_A_BITRATE" name="TO_A_BITRATE">
<option value="96">96</option>
<option value="192">192</option>
<option value="288">288</option>
<option value="384">384</option>
...
</select>
</p>
<p><input type="submit" id="Submit" value="Convert"></p>
</form>