try this code:
success: function( data ){
var evaluateddata = eval('('+data+')');
$.each(evaluateddata,function(index,val){
$('#pgwrapid').append("<img src="+val+" alt="Thumbnail"/>");
});
}
the data is treated as a string after the request, but when it comes json I love to use the hard coded iterative way in javascript (not really fund of using .each() api of jquery so I have a doubt on the above code though not sure if it should be val or should I still identify the variable to access such as val.<variablename>) like this:
success: function( data ){
var evaluateddata = eval('('+data+')');
for(val in evaluateddata)
{
$('#pgwrapid').append("<img src="+evaluateddata[val]+" alt="Thumbnail"/>");
}
}
this is the direct javascript approach to iterate on the json object but it depends on you which one is ideal for you (somehow it would be better if you post the original json string response from your application).
I see the code. how about if you try this code:
if(mysql_num_rows($result) > 0){
//Fetch rows
$output = array();
while($row = mysql_fetch_array($result)){
$output[] = $row['imgurl'];
}
echo json_encode($output);
}else{
echo "No results matching family \"$family\"";
}
your code is actually trying to output a separate json value for each imgurl definitely it won't work because the json value that your application will be returning would be evaluated as one and your code is printing several json values which may cause errors when your javascript code receives it.
valin a console or alert? Maybe the issue is that the wrong data is being returned? - scott.korin