我如何在Cakephp中收到这个ajax param?

时间:2014-02-28 20:42:22

标签: jquery ajax cakephp cakephp-2.0 jquery-select2

我有一个带有ajax的select2插件:http://ivaynberg.github.io/select2/

$("#UserCliente").select2({
placeholder: "Select a State",
 minimumInputLength: 3,
 ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
url: "../clients/listaclients/",
dataType: 'json',
data: function (term) {
    return {
      select: term, // search term
    };
},
results: function (data) { // parse the results into the format expected by Select2.
    // since we are using custom formatting functions we do not need to alter remote JSON data
    return {results: data};
}
}
});

ajax param发送:

enter image description here

我需要获得select值(屁股)。我没有成功地尝试这个:

$this->request['select']

我怎样才能收到这个值?

1 个答案:

答案 0 :(得分:1)

蛋糕方式:$this->request->query['select']

编辑: Cake 2.4+方式> $this->request->query('select')

原生PHP:$_GET['select']

获取DebugKit插件可能是个好主意。帮助您查看各种内容,包括请求值,并让您了解如何访问它们。