0
我建立图像filesnames的阵列(SRC)和ID属性(ID)通过JSON数据循环
var arr = {};
$('.selection .image').each(function(index) {
var $this = $(this),
id = $this.children('img').attr('id'),
src = $this.children('img').attr('src');
arr[id] = src;
});
然后我发送它到PHP脚本执行一些其它功能。
例如{ “8”: “http://www.domain.com/file8.jpg”, “9”: “http://www.domain.com/file9.jpg”}
$.ajax({
type: 'POST',
url: 'array.php',
data: 'array='+JSON.stringify(arr),
dataType: 'json',
success: function(data){
updateContainer(data.reply);
},
});
I” m无法循环php文件中的数据。任何人都可以帮助我比这更进一步?干杯
$json = $_POST['arr'];
$array = json_decode($json, TRUE);
太棒了,这对我帮助很大! – atb