ajax mode,jquery - Using $.ajax with InsertionMode.Replace - Stack Overflow

With MVC5, I'm trying to use $.ajax because I need to replace a partial view on a web page. Using @Ajax.ActionLink works except I can't figure out how to retrieve input field values when inside of Razor because the @Ajax.ActionLink was substituted for the form post button. In JavaScript, I can get the input field values, but the $.ajax method doesn't seem to allow "InsertionMode = InsertionMode.Replace" like the @Ajax call does.

My JavaScript looks like this:

$("#Filter_Form").submit(function (event) {

$.ajax({

type: "POST",

url: "UpdateData",

data: { "filter": GetParamsToSend() },

dataType: "text",

//InsertionMode: InsertionMode.Replace, Doesn't work in the jQuery $.ajax

UpdateTargetId: "PersonListDiv"

});

});

var GetParamsToSend = function() {

var f1 = $('input[name=SearchType]:checked').val();

var f2 = "~";

var f3 = $("#FilterEntry").val();

var filter = f1.concat(f2.concat(f3));

return filter;

};

This calls the correct controller method with the correct parameter, but I don't know how to make it replace the partial view that I'm dealing with, which should be replace at the location "PersonListDiv".

Any help on this would be greatly appreciated.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值