Get array from php, and get its index in jquery using ajax -


i wonder if can access array through jquery index this: output_string['color'][1]

i actually, build array of elements (it works):

php

 $arreglo = array(     'color' => $skin['color'],     'textu' => $skin['imagentextura'],     'header' => $skin['imagen'],     'sombra' => $skin['imagensombra'],     'tooltip' => $skin['tooltipcolor']  );  echo json_encode($arreglo); 

and if want file, array this:

$.ajax({             url: 'ajax.php',             type:'post',             datatype : 'json',             data: { 'datastring': result },             beforesend: function(){                 $("#loader").show();             },             success: function(output_string){                              alert(output_string['color']);                             }       }); 

the problem that, time, more 1 loop loaded, need access this: output_string['color'][1]

thanks

$.ajax({     url: 'ajax.php',     type: 'post',     datatype: 'json',     data: {},     beforesend: function(){         $("#loader").show();     },     success: function(output_string) {          $.each(output_string, function (i, item) {              alert(i + " " +item);         });     } }); 

if php working correctly (as u said) alert each result there.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -