开发者

how to submit form jQuery ajax with passing parameters MVC Asp.net

I want to pass dynamic parameters in $.ajax function. For that i am using following code:

$(function () {

    var postData = 0;
    $('#Index').submit(function () {
        $.ajax({
            type: 'POST',
            url: "/Home/Index",
            contentType: "app开发者_开发知识库lication/json; charset=utf-8",
            data: { 'tabindex':0},
            dataType: "html",
            success: function (data) {
                alert('Inserted');
            }

        });
        return false;
    });
});

but still i m not getting the required result. Can anybody tell me where i m wrong??


Is contentType required?. In the data: {} part, you dont need single quotes around the 'tabindex' variable.

Maybe if you explain what the actual response you get back (via firebug etc) is and what you are trying to achieve would be more helpfull.


I got the answer for this instead of passing addition parameters i have use hidden fields.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜