Загрузить изображение с datauri в качестве источника пустым на пост-вызове ajax

Привет, ребята, я обрезал свое изображение с помощью jcrop, и у меня есть data_uri для обрезанного изображения. Я собрал их все в массив, но кажется, что массив не может быть передан, когда я делаю свой запрос ajax, так как массив пуст в php. вот мой код ниже

JS

var cropped_images = {/**array of data_uris **/};
console.log(cropped_images); // still have my array intact
$.post(url,cropped_images,function(data){
console.log(data) //empty
}
)

PHP

public function url_from_ajax()
{
this->view = false;
return json_encode($this->input->post()) //i'm using codeigniter so the post format is valid
}

0

Решение

Попробуйте привести в порядок ваш массив:

var cropped_images = {/**array of data_uris **/};
var jsonImages = JSON.stringify(cropped_images);
console.log(cropped_images); // still have my array intact
console.log(jsonImages); // still have my array intact
$.post(url,jsonImages,function(data){
console.log(data) //empty
}
)
0

Другие решения

Других решений пока нет …