开发者

How can I add something to serialized form values using jQuery?

I can not figure out the syntax for this.

He开发者_如何学Cre's my code:

$('select[id^="lookup_"]').change(function() {
    var d = $("#lookupform").serializeArray();

            // This is the problem line
            d.push("field=" + $(this).id);

    hash = { type: "POST", url: "/map/details", data: d };
    $.ajax(hash);
    return false;
});

I know that problem line is totally wrong. I basically want to let the server side know from which the submission came from. Can anyone help?


this should do:

d.push( { field: this.id } );


You're very, very close. This will work:

d.push("field=" + this.id);

Or, to be consistent with the other array elements:

d.push({field: this.id});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜