下面介紹jquery提交表單mvc3后臺(tái)處理示例。
JQuery提交表單:
代碼如下:
$(document).ready(function () {
$(#btnLogin).click(function () {
$.ajax({
url: \'/Home/Login\',
data: \'{ account:\' + $(#account).val() + \', psword: \' + $(#psword).val() + \' }\',
type: post,
contentType: application/json;charset=utf-8,
dataType: json
,
success: function (data) {
if (data != )
alert(data);
else
location.href = /Home/Index
}
});
});
});
mvc3后臺(tái)處理:
代碼如下:
[HttpPost]
public ActionResult Login(string account, string psword)
{
JsonResult result;
if ( == account && == psword)
result = this.Json();
else
{
result=this.Json(用戶(hù)或密碼不正確);
}
return result;
}
本文名稱(chēng):告訴你jquery如何提交表單mvc3后臺(tái)處理
當(dāng)前網(wǎng)址:http://www.rwnh.cn/article36/cgjssg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、網(wǎng)站制作、自適應(yīng)網(wǎng)站、網(wǎng)站營(yíng)銷(xiāo)、軟件開(kāi)發(fā)、網(wǎng)站設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)