JSON get value at first index -
i stuck @ , have no idea script clear. see php code:
<?php $arr = array(); $i = 0; while($i < 10) { $arr[] = $i; $i = $i + 1; } echo json_encode($arr); ?>
it returned ajax function :
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
suppose stored in d
javascript variable how can point first value so, stores 0
variable.
if this:
success: function(d) { var = d[0]; }
it returns null.
i don't know how explain question because not @ english.
try this:
success: function(d){ $.each(d, function(x,y){ var = y['field']; }); }