开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜