如何通过ajax将自定义变量传递给服务器?

时间:2013-03-26 13:28:37

标签: php ajax variables

我想将自定义变量发送到url,如customID:5.how我可以添加此代码.Plz帮助

            $("#e8").select2({
            placeholder: "Search for another Concept",
            minimumInputLength: 1,
            multiple: true,

            ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
                url: "sendchat3.php",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        q: term, // search term
                        page: page
                    };
                },
                results: function (data, page) {
                    return { results: data};

                }
            }
        });

1 个答案:

答案 0 :(得分:1)

...
            data: function (term, page) {
                return {
                    q: term, // search term
                    customID: 5,
                    page: page
                };
            },
...