Reputation: 2047
I have a select2 plugin with ajax: 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};
}
}
});
The ajax param sent:
I need to get the select
value (ass). I'm trying this without sucess:
$this->request['select']
How can I receive this value?
Upvotes: 0
Views: 351
Reputation: 867
The Cake way: $this->request->query['select']
EDIT: The Cake 2.4+ way> $this->request->query('select')
Native PHP: $_GET['select']
Might be a good idea to get the DebugKit plugin. Helps you see all kinds of stuff, including request values and gives you an idea how to access them.
Upvotes: 1