$.post('service.php?getPhotos', function(data){
var photoIds = [];
$.each(data, function(){
photoIds.push(this.id);
});
console.log(_photoId); //7962669392
console.log(photoIds); //["7980686507", "7962669392", "7962163506"]
console.log($.inArray(_photoId, photoIds)); //-1
});
爲什麼不是console.log($.inArray(_photoId, photoIds));
返回1
?inArray()返回-1,即使元素存在於數組中