HTML:
<select name="area" style=" background-color:none;filter:Alpha(Opacity=60);opacity:0;" id="person" data-mini="true">
<option value="0" style="color:#FFF; font-size:20px;">Select Person</option>
</select>
的Javascript
function deliveryperson(){
$.ajax({
url: 'mobile/product/deliveryperson',
dataType: 'jsonp',
jsonp: 'jsoncallback',
success:function(data){
console.log(data);
//$("#list").append("<option>Hi</option>");
$("#person").empty();
alert(hi);
var option1 = "<option value='0'>Select person</option>";
$("#person").append(option1);
$.each(data, function(i,item){
if(item.name != "Ingredients"){
var option = '<option value="'+item.name+'">'+item.name+'</option>';
$("#person").append(option);
}
});
$.mobile.loading('hide');
}
});
}
使用此网址我得到了像这样的输出
Array (
[0] => Array ( [id] => 2 [name] => alandur2 [contact] => 1236547896 [areaname] => Alandur MKN Road [username] => alandur2 [password] => d11938279d313e5000c2dfb16db8eeb1 [delflag] => 1 [status] => 0 )
[1] => Array ( [id] => 3 [name] => alandur3 [contact] => 9876543214 [areaname] => Alandur MKN Road [username] => alandur3 [password] => d11938279d313e5000c2dfb16db8eeb1 [delflag] => 1 [status] => 0 )
[2] => Array ( [id] => 4 [name] => alandur4 [contact] => 9632587415 [areaname] => Alandur MKN Road [username] => alandur4 [password] => 04e4e8a85497746ce540ead2d9348f67 [delflag] => 1 [status] => 0 )
[3] => Array ( [id] => 5 [name] => alandur5 [contact] => 8547321697 [areaname] => Alandur MKN Road [username] => alandur5 [password] => 39558146c0883cf8bdaacd26b549cc0b [delflag] => 1 [status] => 0 )
[4] => Array ( [id] => 6 [name] => alandur1 [contact] => 9566435861 [areaname] => Alandur MKN Road [username] => alandur1 [password] => 590a60b1e1c85f9a778a4adb649b2a8c [delflag] => 1 [status] => 5 )
)
我只需要来自这个数组的名字。但是我无法附加值。请告诉我这个编码中的错误。