这是来自 json_encode() 文件的 json 字符串:
[{"ID":"650","DESCR":"FRONTAGE","MAINURL":"images\/98\/30-HEATH (1).JPG","THUMBURL":"images\/98\/30-HEATH (1).JPG","ALBUM":"98"},{"ID":"651","DESCR":"PICTURE","MAINURL":"images\/98\/30-HEATH (2).JPG","THUMBURL":"images\/98\/30-HEATH (2).JPG","ALBUM":"98"},{"ID":"652","DESCR":"PICTURE","MAINURL":"images\/98\/30-HEATH (3).JPG","THUMBURL":"images\/98\/30-HEATH (3).JPG","ALBUM":"98"}]
这是我正在使用的电话。它确实给出了一个对象,但是每次我尝试访问它时,我都会从 chrome javascript 控制台收到一个类型错误。
function FindPictures(b) {
var picturesHome = {};
var album = "";
var baseURL = b;
this.pics = function(alb){
album = "";
$.ajax({
async: false,
url: "picsJSON.php",
dataType: 'json',
success: function (json) {
picturesHome = json;
},
error: function (error) {}
});
return picturesHome;
};
};