我正在开发一个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>