05-28-2012 11:14 AM
I've built an application which loads statistics from an external xml file on the web. It works fine in a browser but after packagaing it with webworks and running it in the simulator the AJAX never loads.
I've added
<access subdomains="false" uri="http://www.mysite.com"/>
to my config file but that didn't help. Are there any other permissions or things I need to set to get this working?
Solved! Go to Solution.
05-28-2012 12:03 PM
Try using this:
<access subdomains="true" uri="*"/>
If that doesn't work then we'll know it's not a config issue.
05-28-2012 03:14 PM
That doesn't help but works fine in browser and also works fine when packaged from phonegap to Android. Will have to try using phonegap instead of webworks and see if it works then.
05-28-2012 03:47 PM
With phonegap I get the following errors poping up
gap : ["Network Status", "getConnectionInfo","Network Status0",true]
gap: ["Device","getDeviceInfo","Device1",true]
gap_init:
gap_callbackServer:
gap_poll:
05-30-2012 10:38 PM - edited 05-30-2012 10:40 PM
It looks like cross-origin resource sharing issue. You probably have to use CORS
Enable it on server-side: http://enable-cors.org/
In your javascript, use this to request for the remote content:
// Create the XHR object.
function createCORSRequest(method, url) {
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
// XHR for Chrome/Safari/Firefox.
xhr.open(method, url, true);
} else if (typeof XDomainRequest != "undefined") {
// XDomainRequest for IE.
xhr = new XDomainRequest();
xhr.open(method, url);
} else {
// CORS not supported.
xhr = null;
}
return xhr;
}
// Make the actual CORS request.
function makeCorsRequest() {
var url = "http://www.example.com/";
var xhr = createCORSRequest('GET', url);
if (!xhr) {
alert('CORS not supported');
return;
}
// Response handlers.
xhr.onload = function() {
var text = xhr.responseText;
// Do something with returned text data
};
xhr.onerror = function() {
alert('Woops, there was an error making the request.');
};
xhr.send();
}
Hope this helps.
06-23-2012 09:57 PM
Tim Windsor helped me out with this one. The solution was to add the following to the webworks config.xml file.
<rim:connectiontimeout="60000">
<id>BIS-B</id>
<id>TCP_WIFI</id>
<id>TCP_CELLULAR</id>
<id>MDS</id>
<id>WAP2</id>
<id>WAP</id>
</rim:connection>
08-21-2012 12:57 AM
Hi All,
Working with phonegap, trying to capture an image using the device camera and upload the image to the server.
This works with me android phone. When tried in Blackberry 9300 , 9360 it throws Internal server server :500
Can someone help me on how to resolve it.
thanks and regards,
Hema