Calling a different action from view using jQuery Ajax fnc
My view url is /Customer/Detail/1
I would like to update a div
element in this view, but I cannot reach the action method. I am using jQuery like this:
$.ajax({
type: "POST",
url: "List",
data: formData,
success: function(newHtml) {
setTimeout(function() {
$("#grid").html(newHtml);
}, 500);
},
error: function(request, textStatus, errorThrown) {
alert("AJAX error: " + requ开发者_开发问答est.statusText);
}
});
The issue is with the url
value. Eveything from this url attribute is added to the end of the actual view url. So for this example I'll get /Customer/Detail/List
but I need /Customer/List
or even /Order/List
Is this possible ?
Try typing the url with a starting slash. Like that:
url: "/Customer/List"
do method in /Customer/Detail/List and then redirect it to /Customer/List or /Order/List
精彩评论