facebook

including asp or php scripts to use with JQuery/AJAX

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #309656 Reply

    conradvdp
    Member

    Congratulations with M9!

    I am trying to use JQuery/AJAX to get data from my server and integrate in the mobi app.

    If I’m correct, I can only run scripts from the local server and since that’s on the appstore (after publishing) I think I would need to include some asp or php scripts for the server roundtrip.

    Am I on the right track with this? I am using this JQuery line to fill the “result” element with the content of the html page (‘HTMLPage2.htm’).

    $(‘.result’).load(‘HTMLPage2.htm’);

    This works on my sample website (not mobi) and would like to see the same mechanism work in the MobileOne app that I’m testing…

    -C

    #309678 Reply

    remi_grumeau
    Member

    Well actually, you can’t access/load a content on another domain using Javascript (for security reasons).

    Not that much a MobiOne issue…

    #309684 Reply

    wayne
    Moderator

    Conrad,

    As Remi identified directly loading HTML content from a site other than the origination site, AppSync in your case, results in a cross site scripting (XSS) violation. The common solution to get around this is for requests to a non-origination site to use a dynamic script tag and access a service that returns JSON content (serialized JavaScript). Here’s some info on this topic http://www.xml.com/pub/a/2005/12/21/json-dynamic-script-tag.html

    Wayne
    Genuitec Mobile Team

    #309694 Reply

    conradvdp
    Member

    Hi guys,

    Of course, cross side scripting is a concern if not done right.

    The main reason is that I need real time data (HTML formatted) from my database pulled into the MobiOne app.

    I did some research and testing and came across this JQuery modification using YQL (and it supports SSL) and think it is safe to use. If not, please let me know and I’ll look into other solutions.

    http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/

    -C

    #309723 Reply

    wayne
    Moderator

    Conrad,

    Thanks for the nice reference. I plan to try this approach in a couple of demos I’m creating.

    Wayne
    Genuitec Mobile Team

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: including asp or php scripts to use with JQuery/AJAX

You must be logged in to post in the forum log in