2013-12-18 16:12
浏览 55


I am working with phonegap and dreamweaver to setup a small application but i am facing a problem as i am a new in phonegap.

I have an HTML5 file and my css file also the config.xml form my icon, splashscreen etc. Phonegap reads only the index.html and not the index.php file.

So i made a grab.php file to pull some data from my hosting. Localhost everything works great but when i am build the app it doesn't load the data...

Here is my html file and grab.php file.

<!doctype html>
<meta charset="utf-8">
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<title>Celebrity.Com | Android App</title>
<link rel="stylesheet" type="text/css" href="mobile_css/style.css" media="all" />
<script type="text/javascript" src="js/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">

<script type="text/javascript">
$(document).ready(function() {



<div class="headerHolder"><div class="logo"></div></div>
<div style="width:100%; height:20px; float:left; margin-bottom:1px;"></div>

<div class="loa" style="width:100%; padding-bottom:5px;">

<div style="clear:both;"></div>


And grab.php

require "connectiondb.php";
$bann = mysql_query ("SELECT * FROM info ORDER BY a_name");
while($bannerl = mysql_fetch_assoc($bann)) {
echo '
<div class="articleHolder">
<div class="imageholder"><img src="'.$bannerl['a_image'].'" width="180" height="120"/></div>
<div class="controlz"><span style="float:left;">'.$bannerl['a_name'].'</span><img style="width:65px; height:65px; float:right;" src="images/details.png" width="65" height="65" border="0"></div>

I tried to upload the grab.php file to my server and load it from here but i think that the policy doesn't let me to run, load files from other servers.

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dqh1992 2013-12-18 16:16

    You need to put your host in a whitelist (http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html)

    Then you have to specify in Phonegap configuration your domain:

    Then you can make ajax requests, but you have to specify the domain, so needs to be something like:

    <script type="text/javascript">
    $(document).ready(function() {
    打赏 评论

相关推荐 更多相似问题