Reputation: 117
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
function getProductDetails() {
var link = '**/Product/Details?callback=?**';
$.ajax({
url: link,
data: {},
dataType: "jsonp",
jsonpCallback: "doextrawork"
});
Upvotes: 1
Views: 6831
Reputation: 1039438
var link = '/Product/Details?callback=?';
$.ajax({
url: link,
data: { id: '<%= ViewContext.RouteData.Values["id"] %>' },
dataType: "jsonp",
jsonpCallback: "doextrawork"
});
Upvotes: 4
Reputation: 40863
simply pass a json object with your id as a property.
$.ajax({
url: link,
data: {
id: 2
},
dataType: "jsonp",
jsonpCallback: "doextrawork"
});
Upvotes: 0