jquery移动相当新,解析json的新手 - 做了很多研究无济于事.在settimeout函数中尝试了10秒延迟
我的应用程序在我的三星galaxy s2上正常工作,但在我的三星Galaxy平板电脑10.1上它做了以下.
使用最新jquery 1.2.0和jquery-1.7.2
我打电话getlocations2.php,如果我返回四个或更少的项目,可折叠集合正确打开和关闭.如果我退回5件或更多物品:
感谢您的任何提示:
代码:
function doajax2($vurl,$vdata,$vtype,$vfrom){
$.ajax({
url: $vurl,
dataType: 'json',
data:$vdata,
async: false,
success: function(rtndata) {
$.mobile.hidePageLoadingMsg(); //alert(result.toSource())
rtndata2=(JSON.stringify(rtndata, null, 4));
rtndata2=rtndata2.substring(13);
rtndata2=rtndata2.slice(0, -2)
var res = eval(rtndata2);
$('.displaylocations').html('');
g_html=res[0].brand;
if (res[0].id> -1){
g_html=g_html+'<div data-role="collapsible-set" data-theme="f" >';
for (var i=0;i<res.length;i++){
//for (var i=0;i<6;i++){
lochtml('loc',i,res[i].locid,res[i].loccode1,res[i].head,res[i].desc,res[i].lang,res[i].lat1,res[i].long1,res[i].img1,res[i].limit);
}
g_html=g_html+'</div>';
}
console.log('g_html'+g_html);
$('.displaylocations').css('display','none');
$(".displaylocations").html(g_html);
// $(".displaylocations").html(str);
setTimeout(function(){ //make sure displaylocations has been updated
$('#lhead2').html('Tuhura <span lang="en">Locations</span>'); …Run Code Online (Sandbox Code Playgroud)