ASP.NET MVC提交到服务器的几种方法

时间:2023-03-09 01:12:23
ASP.NET MVC提交到服务器的几种方法

多年不搞WEB开发了,最近有个小活干干,记录一下学习的心得。

以下为几种脚本向服务器提交的方法:

1.

$.ajax({

type: "GET",

url: "/TestRec/TaskConfig",

data: { id: typevalue },

dataType:"html",

success: function (evt) {

$('#divEdit').html(evt);

}

});

2.

document.forms[0].action = '@Url.Action("TaskConfig", "TestRec")';

document.forms[0].submit();

3.

$.post("TaskConfig",

{ frontViewData: 2 },

function (resultOk) {

alert("操作");

});