See this question first, and the top answer. That being said, I need to issue an XMLHttpRequest to a remote server from a mobile app. Can someone show an example? I can't figure out where to specify the URL (with parameters) as shown in the answer to the previous question.
Asked
Active
Viewed 162 times
0
-
WAIT: the open method on the XHR object has parameters open(method,url,async)......if I put a full URL in the URL, is that all that's needed? I always interpreted that as just taking the location of the file on the server, assuming the page were querying its own server rather than a 3rd party server. – temporary_user_name Apr 21 '12 at 00:04
1 Answers
1
XMLHttpRequests takes a URL as a parameter. It can be a relative URL, but it can also be a fully qualified URL...except that it probably won't do what you want, due to cross-site scripting protections built into most browsers.
This question has details on solutions to this issue.
-
But this isn't being done from a browser-- it's being done from a PhoneGap mobile app. – temporary_user_name Apr 21 '12 at 01:59
-
1Huh, might just work then. In any case, yes, XMLHttpRequest can take a fully qualified URL. – larsks Apr 21 '12 at 02:00