这是我要单击提交然后运行功能的表单 HTML 和 JavaScript 代码ExportPublication()
:
<form onsubmit="ExportPublication()" class="form-horizontal" id="frmExportPublication" name="frmExportPublication" >
<div class="control-group">
<label class="control-label" for="inputPassword">email Pa</label>
<div class="controls">
<textarea name="emailBody" class="input-xlarge">file</textarea>
</div>
</div>
<input type="submit" class="btn btn-primary" id="ExportPublicationButton" projectid="" value="submit">
</form>
<script>
function ExportPublication() {
$.ajax({
url: '@Url.Action("CreateOutput", "Publication", new { area = "Cartable" })',
data: $("#frmExportPublication").serialize(),
type: 'POST',
beforeSend: function () {
ajaxWaiting.showWaiting();
},
success: function () {
$("#message").show();
ajaxWaiting.hideWaiting();
$('#ExportPublication').modal('hide');
},
error: function (req, status, error) {
ajaxWaiting.hideWaiting();
}
});
}
</script>
当我点击提交时,功能不起作用。我该如何纠正?