使用jquery提交form表单并自定义action的实现代码
使用jquery提交form表单并自定义action的实现代码
$(function () { $("#btn").click(function () { var usercode = $("#UserCode").val(); var verifycode = $("#Verifycode").val(); if ($.trim(usercode) == "" || $.trim(verifycode) == "") { alert(" 您的[客户号]或者[验证码]必须填写!"); return false; } else { document.SearchForm.action = '/index/Search?u=' + usercode; document.SearchForm.submit(); } }); });
<form id="SearchForm" name="SearchForm" method="post"> …… </form>
好处是:既想使用post提交表单,又想传递你想传递的某一个参数!
相关推荐
wcqwcq 2020-07-04
TONIYH 2020-06-11
yhginny 2020-04-20
nicepainkiller 2020-05-12
Lius 2020-05-05
longshengguoji 2020-02-13
ajaxtony 2020-02-03
HSdiana 2019-12-15
taiyanghua 2019-12-02
sunnyishere 2014-01-22
86580599 2019-09-23
shumark 2014-05-29
爱好HtmlCssJs 2019-10-28
shumark 2014-07-07
AngelicaA 2015-03-14
81751330 2015-03-10
kentrl 2016-05-03
Qc 2020-07-19
swiftwwj 2020-07-05