hey every one i want to call controller action using ajax. but its gives an error. "resource cannot be found". javascript function call successfully controller action is not call
here is my view code:
<a class="btn btn-primary" onclick="EditUser('Delete', 'Users', '@Model.Items.ElementAt(i).ID');">Link</a>
function EditUser(action, controller, id)
{
alert(action);
alert(controller);
alert(id);
$.ajax({
type: "POST",
url: '@Url.Action("Edit", "Users")',
data: "{ id: '" + id + "'}",
success: function (response) {
if (response.d != '1') {
alert('Not Saved!');
}
},
error: function (response) {
if (response.responseText != "") {
alert(response.responseText);
alert("Some thing wrong..");
}
}
});
}
and here is my controller action.
public override ActionResult Edit(int id = 0)
{
int a = id;
return View("Edit", DTO);
}