Get Query String value with Jquery, AJAX in ASP.NET MVC
HI,
i need to pass id=2 while calling the action method ? How can i pass id value to controller
http://localhost:52391/Campaign/Edit/2
{Controller}=Product {ActionMethod}=Action {id} =2
开发者_如何学JAVA function getProductDetails() {
var link = '**/Product/Details?callback=?**';
$.ajax({
url: link,
data: {},
dataType: "jsonp",
jsonpCallback: "doextrawork"
});
var link = '/Product/Details?callback=?';
$.ajax({
url: link,
data: { id: '<%= ViewContext.RouteData.Values["id"] %>' },
dataType: "jsonp",
jsonpCallback: "doextrawork"
});
simply pass a json object with your id as a property.
$.ajax({
url: link,
data: {
id: 2
},
dataType: "jsonp",
jsonpCallback: "doextrawork"
});
精彩评论