나는이 PHP 코드json을 사용하여 배열을 전달 하시겠습니까?
$ids = array(1,2,3);
$names = array("cat","elephant","cow");
$originalSettings = array ('ids'=>$ids,'names'=>$names);
$jsonSettings = json_encode($originalSettings);
echo $jsonSettings;
이
$.post("ajax.php", {},
function(data){
data.ids.each(function(i) {
alert(data.names[i]);
}
//is it possible to receive the arrays and navigate them
}, "json");
가 어떻게 전달할 수 jQuery 코드는 배열이 사용하는 JSON을 가지고 자바 스크립트를받을 수?
감사
당신은 당신의 경고 후 누락 브래킷이 (나에게 의미가 있습니다 –
감사 전화입니다 즉, {{alert (data.array2 [i]);}); – ahmed