2
在我的phonegap/cordova應用程序中,我有一個化身列表。 在應用程序上獲取這些圖像的最佳方式是什麼? 使用文件傳輸插件下載圖像更好嗎?或者最好讓他們通過ajax調用下載它們作爲二進制文件?還有別的嗎? 圖像必須每天下載兩次,因爲用戶每天更新它們兩次。Phonegap/Cordova:從服務器獲取圖像
在我的phonegap/cordova應用程序中,我有一個化身列表。 在應用程序上獲取這些圖像的最佳方式是什麼? 使用文件傳輸插件下載圖像更好嗎?或者最好讓他們通過ajax調用下載它們作爲二進制文件?還有別的嗎? 圖像必須每天下載兩次,因爲用戶每天更新它們兩次。Phonegap/Cordova:從服務器獲取圖像
你可以嘗試這樣的
<body>
<h1> Get Picture </h1>
<button onclick="getPicture()">Get here</button>
<div data-role="">
<img id="productPic">
</div>
</body>
使用JSON服務器獲取圖像。
function getPicture()
{
$
.getJSON("http://yoururlhere/getImage.action",
{}, function(data) {
processPictureData(data);
});
}
function processPictureData(data)
{
$.each(data.PICTURE, function(i, product) {
$('#productPic').attr('src', product.LOCAT);
});
}
看看例子http://javalearnersproblems.blogspot.in/2012/05/code-for-displaying-image-in-phonegap.html