function export(){
$.ajax({ url: "@Url.Content("~/controllr/method")",
type: 'GET',
data: { selectedValue : $("#BranchId option:selected").text() },
traditional: true,
async:false,
success: function (result ) {
},
failure: function () {
failed=true;
alert("Error occured while processing your request");
},
error: function (xhr, status, err) {
failed=true;
alert("Error occured while processing your request");
}}
答案 0 :(得分:0)
您是否尝试在控制器操作上设置断点并查看其是否被命中?请尝试以下基本代码,看看通话是否正常通过
$.ajax({
url: ‘@Url.Content(“~/MyController/MyMethod”)’,
type: ‘post’,
data: {
selectedBranchId : $("#BranchId option:selected").text()
}
});
// I am the controller action
public ActionResult MyMethod(string selectedBranchId)
{
// your code
}
请注意我已删除所有回调代码并更改了控制器名称和操作名称以及回发变量的名称