Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Transfer data from domain to mobile

  • 15-02-2013 02:31PM
    #1
    Registered Users, Registered Users 2 Posts: 156 ✭✭


    I am looking at writing an javascript web app to reside on a mobile and to pull data from a domain. I own the domain so I have full control over it. I currently have a PHP application connecting to a MySQL database on it. What I am wondering is how to access this from the mobile.

    Should I be building a web service on the domain I am accessing to communicate with or should I just use an AJAX request to a page on the domain from the mobile app using JSONP?

    I have never used web services and am wondering if this is an appropriate situation or is it unnecessary?

    Any help or advice much appreciated

    Sean


Comments

  • Moderators, Society & Culture Moderators Posts: 17,642 Mod ✭✭✭✭Graham


    An easy way to start would be to create a PHP web page that grabs data from from your database, drops it into an array which is then encoded as JSON.

    e.g if the $resultLine array contains all your books:
    echo(json_encode(array('BookCatalogue'=>$resultLine)));
    


  • Registered Users, Registered Users 2 Posts: 92 ✭✭jgh_


    JSON is fine. check out PhoneGap to develop apps using JavaScript and HTML5 if you don't require any native frameworks


  • Banned (with Prison Access) Posts: 1,332 ✭✭✭desaparecidos


    JavaScript in mobile apps does not follow the same domain rule so you can perform ajax requests just like you would if writing a webpage on your site.

    So you can use JSON, JSONP, plain text, XML, HTML views etc


Advertisement