ローカルのmysqlから取得した次のjsonオブジェクトがあります。
<([{"ID":"1","Title":"Chicken & Chili","Price":"$8.99","ImageURL":"\/images\/dinner\/chicchili.jpg","Serves":"2","Description":"This unique and delicious chicken chili is a much-requested meal around our house. I think you'll find it's a nice change of pace from the typical beef version."},{"ID":"2","Title":"Chicken Franchase","Price":"$9.99","ImageURL":"\/images\/dinner\/chicfran.jpg","Serves":"2","Description":"Served in a lemon and butter sauce"},{"ID":"3","Title":"Salmon","Price":"$14.99","ImageURL":"\/images\/dinner\/salmon.jpg","Serves":"1","Description":"A simple soy sauce and brown sugar marinade, with hints of lemon and garlic, are the perfect salty-sweet complement to rich salmon fillets."}]);
次のコードを使用して、jsonオブジェクトをiPhoneシミュレーターに取り込みました。画面にタイトルと価格を表示するのに成功しましたが、画像は表示されません。画像を取得する方法はありますか?または、コーディングに何か足りないものがありますか?何か提案がありますか?
$(document).ready(function(){
var output = $('#output');
$.ajax({
url: 'http://localhost/Backend/getDinner.php',
dataType: 'jsonp',
jsonp: 'jsoncallback',
timeout: 5000,
success: function(data, status){
$.each(data, function(i,item){
var Menu_Dinner = '<li><a href="detail.html?id=' + item.ID + '">' +
'<img src="images/dinner/'+ item.ImageURL + '">' +
'<h2 class="ui-li-heading">' + item.Title + '</h2 >' +
'<h2>' + 'Price: ' + item.Price + '</h2>'+ '</a></li>';
output.append(Menu_Dinner);
});
},
error: function(){
output.text('There was an error loading the data.');
}
}); });