Hi, i'm trying to pass a javascript array to a php controller ( i'm using codeigniter ) with ajax post method. Data seems to be sent but $_POST['data'] is not known. This is the code :
JAVASCRIPT:
function update_order(){
var ordre_column1 = $('#column1').sortable('toArray');
var data = serialize(ordre_column1);
$.post('../../controlleur_groupe_admin/ordre_box',data);
}
MY CONTROLLER:
function ordre_box() {
$data = $this->input->post('data')
$array = unserialize($data);
print_r($array);
}
I got no return in firebug, i'm wondering if content type is wrong:
Content-Type application/x-www-form-urlencoded; charset=UTF-8
thanks.
To simplify the code a bit :
Javascript :
function update_order(){
var ordre_column1 = $('#column1').sortable('toArray');
var data = ordre_column1.toString();
$.post('../../controlleur_groupe_admin/ordre_box',data);
}
Controller :
function ordre_box() {
echo $_POST['data'];
}
Firebug say :
Message: Undefined index: $data
But the post exists : Paramètresapplication/x-www-form-urlencoded 131,126,125,156,154 Source 131,126,125,156,154