我正在基于WordPress中的另一个专业插件开发一个插件。我想停止用另一个插件编写的Ajax表单提交。我无法在其他插件中更改Ajax代码。
当前场景
当我提交表单时,它将带我到新页面,但同时它还会运行ajax请求。我想停止该ajax请求。简而言之,我只想用新页面正常提交我的表格。
的HTML
<form id="redirect_form" class="abc-form" method="post" name="New Form" action="http://example.com/form-redirect">
<label for="form-field-field_1" class="abc-field-label">Test</label>
<input type="text" name="form_fields[field_1]" id="form-field-field_1" placeholder="Enter a location" autocomplete="off">
<button type="submit" class="form_redirect_to">Submit</button>
</form>
jQuery的
jQuery(document).ready(function($){
jQuery('#redirect_form').on('submit',function(e){
e.preventDefault();
e.stopPropagation();
$(this).off("submit");
this.submit();
return false;
});
});
人到中年有点甜
相关分类