我有一個選擇2使用Ajax插件:http://ivaynberg.github.io/select2/我如何在Cakephp中接收這個ajax參數?
$("#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};
}
}
});
發送阿賈克斯PARAM:
我需要得到select
值(屁股)。我試圖沒有成功:
$this->request['select']
我怎樣才能得到這個值?
請注意,當您期望JSON作爲返回內容時,URL應爲'/ clients/listaclients.json'。參見[ajax-and-cakephp](http://www.dereuromark.de/2014/01/09/ajax-and-cakephp/)。另外:你應該總是提到你正在使用的確切cakephp版本。 – mark