I want to develop a Phonegap application and I am using jQuery Mobile. I am developing and testing via Firefox on the PC, so the issues described here don't have anything todo with Phonegap - this is an Firefox PC issue:
The following code does not work and I would need some help to point me in the right direction:
var loadWeather = function()
{
// Request absetzen
$.ajax(
{
// the URL for the request
url : 'http://www.google.com/ig/api',
// the data to send (will be converted to a query string)
data : {
weather : 'Vienna'
},
// whether this is a POST or GET request
type : 'GET',
// the type of data we expect back
dataType : 'xml',
// code to run if the request succeeds; the response is passed to the function
success : function(xml)
{
parseXML(xml);
},
// code to run if the request fails;
// the raw request and status codes are passed to the function
error : function(xhr, status)
{
alert('Error retreiving weather!');
}
});
}
status is "error", xhr.readyState=0, xhr.status=0, so I don't get any info for the reason from jQuery at all. The request is executed, the answer-header (from Firebug) is:
Accept: application/xml, text/xml, */*; q=0.01
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding: gzip, deflate
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Connection: keep-alive
Host: www.google.com
Origin: null
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
and 200 OK. So why I am jumping in the error case? xhr.isRejected() says true. What does this mean?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…