- This topic has 4 replies, 3 voices, and was last updated 14 years, 4 months ago by wayne.
-
AuthorPosts
-
conradvdpMemberCongratulations 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
remi_grumeauMemberWell actually, you can’t access/load a content on another domain using Javascript (for security reasons).
Not that much a MobiOne issue…
wayneModeratorConrad,
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
conradvdpMemberHi 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
wayneModeratorConrad,
Thanks for the nice reference. I plan to try this approach in a couple of demos I’m creating.
Wayne
Genuitec Mobile Team -
AuthorPosts