I have this code to send data:
function insert_new_image()
{
var ids = [];
$('.be-imagecontainer').each(function(i){
ids[i] =$(this).find('span').text();
});
var jsonids = {'ids' : ids}
var url = base_url + 'ajax/get_new_images';
$.ajax({
url : url,
data : {'ids' : jsonids},
success : function(response)
{
$('#be-images ul').prepend(response)
},
dataType: 'html'
});
}
and this code from the server(PHP):
function get_new_images()
{
$ids = json_decode($_GET['ids'], true);
echo Kohana::debug($ids);
}
the server responds with a
null
how can I make this work? I am trying to send a json data containing an array of ids to the server