在phonegap的帮助下,我正在制作一个Android应用程序,其中我使用了phonegap sqlite数据库,我将数据存储在数据库中并从数据库中取回显示但是我的图像没有显示,只有路径到哪里图像已存储。请帮我找错。
在JQuery中: -
function List() {
$.ajax({
type: "GET",
url: "one.html",
contentType: "text/xml",
dataType: "xml",
data: "",
crossDomain: true,
success: function(xml) {
$(xml).find('xyz').each(function() {
var title = $(this).find('title').text();
var Image = $(this).find('image').text();
db.transaction(function(transaction) {
transaction.executeSql('INSERT INTO A
VALUES ("' + title + '","' + Image + '")',
nullHandler, errorHandler);
});
});
Dynamic_List();
return false;
}
}
});
}
/*This Method Create Dynamic Menu Item List*/
function Dynamic_List() {
$('.mylistview').empty();
db.transaction(function(transaction) {
transaction.executeSql('SELECT * FROM A;', [],
function(transaction, results) {
if (results != null && results.rows != null) {
for (var i = 0; i < results.rows.length; i++) {
var image = results.rows.item(i).A_Image;
var Title = results.rows.item(i).A_Title;
$('.mylistview').append(
'<li class = "cat_list">' +
'<div class = "divli">' +
'<div class = "menuImg" ' +
'style = "height:48px; width:48px;">' +
menu_image +
'</div>' +
'<div class = "divbody">' +
'<h3>' + menu_Item_Title + '</h3>' +
'</div>' +
'</div>' +
'</li>');
}
}
}
}, errorHandler);
}, errorHandler, nullHandler);
return;
}
在HTML5中: -
<div class = "foodList">
<ul class = "mylistview"
style = "display: block;"
id = "my_dynamic_list_view">
</ul>
</div>
答案 0 :(得分:1)
var Image = $(this).find('image').text();
这只保存图像的url,如果需要保存完整图像需要将图像转换为base64并保存。并给出像这样的图像src
<img src="data:image/gif;base64,UR base64 hash" />