我正在做一个Phonegap 项目。当我在浏览器和 Android 模拟器上尝试时,它可以工作,但是当我在 Android 手机上尝试时,它不起作用。这是我的代码在电话上不起作用。
function sta_graph() {
var selectedGraph = document.getElementById ( "sta_statistic" ).value;
var url = "http://"+serverIP+"/prtCar11/php/Stations.php/" + selectedStation + "/" + selectedGraph;
if(selectedGraph != "") {
var graphObject;
var xAx;
var yAx;
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.open('GET',url,false);
xmlhttp.send();
var json = xmlhttp.responseText;
obj = JSON.parse(json);
graphObject = obj.data;
xAx = obj.xAxis;
yAx = obj.yAxis;
drawGraph('#sta_flot', xAx, yAx, graphObject);
}
}
这是 Eclipse LogCat 给出的错误。谢谢你的帮助。
05-12 22:18:31.049: E/Web Console(18630): Uncaught SyntaxError: Unexpected token ILLEGAL at file:///android_asset/www/index.html#statistics:1
05-12 22:18:38.219: I/Web Console(18630): exception firing pause event from native at null:1
这是我的统计页面:
<div data-role="page" class="section" id="statistics">
<div class="header" data-role="header">
<a href="#stationpage" data-role="button" data-rel="back" data-icon="arrow-l" data-theme="c">Back</a>
<h1>PRT Yönetim Paneli</h1>
</div>
<div class="content" data-role="content" id="content5">
<select class="span12" id="sta_statistic" onchange="sta_graph();" >
<option value="">Bir grafik seçiniz.</option>
<option value="numberOfPassenger">Yolcu Sayısı/Zaman</option>
</select>
<div id="sta_flot" style="width: 300px; height: 250px;"></div>
</div>
<div class="footer" data-role="footer">
</div>
</div>