本机应用程序在iOS中模拟,但在Android中不模拟 - 是JS吗?


Native app emulates in iOS but not in Android - Is it the JS?

我正在尝试使用phonegap和jqm制作一个本机应用程序。 当我在 DW 中测试我的应用程序并使用 xcode 模拟它时,一切似乎都运行良好。 当我尝试模拟Android应用程序时,问题出现了。

静态HTML元素呈现良好,但动态元素无法在Android中呈现。 这是我尝试使用javascript渲染的HTML:

// JavaScript Document
//var serviceURL ="http://localhost/UnitedTrackClub/";
$(document).ready(function(e) {
var schedule;
$('#scheduleListPage').bind('pageinit', function(event) {
getScheduleList();
});
function getScheduleList() {
$.getJSON(serviceURL + 'get_schedule_hdr.php', function(data) {
    $('#scheduleList li').remove();
    schedule = data.items;
    $.each(schedule, function(index, employee) {
        $('#scheduleList').append('<li><a href="scheduledetail.html?id=' + employee.Duration + '">' +
                '<h4>' + employee.Event_Date + ' ' + employee.Meet_Name + '</h4>' +'</a></li>');
    });
    $('#scheduleList').listview('refresh');
});
}
});

有人有什么建议吗?

谢谢

对我来说

,它似乎在获取数据之前打印了 HTML,我发现本机 jQuery $.ajax() 在 JQMobi 中比 getJSON 效果更好,所以我会这样做:

$.ajax({
    url      : serviceURL + 'get_schedule_hdr.php',
    dataType : 'jsonp',
    crossDomain: true,
    success  : function(data) {
    $('#scheduleList li').remove();
    schedule = data.items;
    $.each(schedule, function(index, employee) {
    $('#scheduleList').append('<li><a href="scheduledetail.html?id=' + employee.Duration + '">' +
            '<h4>' + employee.Event_Date + ' ' + employee.Meet_Name + '</h4>' +'</a></li>');
});
$('#scheduleList').listview('refresh');
    }
});

但我并没有真正检查你的代码