2 Replies Latest reply on Dec 20, 2016 5:35 AM by somename777

    iOS App not showing any data


      I created the site with Framework7 and Phonegap. When I host the site on localhost using WAMP im able to see the data loaded from the MySQL DB.

      But when Im trying to view the site from Phonegap app, nothing is returned.

      My code in my-app.js :


      $$(document).on('pageInit', '.page[data-page="ajaxdbtest"]', function(e){  
      el = $$("#showcontent"); 

      .getJSON('http://localhost/mytestapp/MyApp1/www/ajaxdbtest.php', function(data) {
      $$.each(data, function(n, theData) {  el.innerHTML += '<p>'+theData.name+'</p>';


      This code works perfect if i copy the content on localhost and view it so im sure nothing wrong with the ajaxdbtest.php page.

      I've added header('Access-Control-Allow-Origin: *'); in the ajaxdbtest.php and checked that <access origin="*" /> is set in the phonegap config file.

      I commented the content-security-policy line from the head of the index page.

      I've not build the app yet. Just trying to view it from the Phonegap app from iPhone 5. Im using Framework7. Everything works fine on my laptop. Its just on the app its not showing any DB related data.

      Any help much appreciated.


        • 1. Re: iOS App not showing any data
          VectorP Level 4

          Even if you managed to make it work in the Phonegap app, how relevant would that be?

          You want to build an app eventually, which is a client (not a server) where 'http://localhost' is usually quite meaningless, especially when you expect to pull data from a central remote database.

          • 2. Re: iOS App not showing any data
            somename777 Level 1

            Thanks for your answer? My question is do i need to add any code for iOS to the index page for it to show DB values? Cause I've tried the following paths for img src:


            But nothing works at all. Only if I give a path to the image beforehand, like on a page if i specify the image only than it loads. But nothing from the database is displayed. Not even text values. Its not to do with the images only. Text values are not displayed either. If i view the page from my iphone, everything loads fine. Its only from the Phonegap iOS App that i cant view any values from the DB. I am using $$get.JSON on pageInit to show the values.


            Is it safe to assume that when I build the app it will work since its working locally. Of course I will be using absolute paths in the DB.