I am building a web application where I need to get XML data from several cross-domain feeds.
The annoying thing is: they're cross-domain. I currently use a jQuery (script) on the "local" domain, which fetches the XML from the other domain.
For enabling CORS I added headers and here is my code
$.ajax({
url: '/CurrencyConvertor.asmx/ConversionRateFromCurrency=USD&ToCurrency=INR',
type: 'post',
crossDomain: true,
ContentType: 'application/xml',
Origin: 'http://www.webservicex.net',
headers: {
'Access-Control-Allow origin': 'http://www.webservicex.net',
'Access-Control-Allow-Credentials': 'true',
'Request Headers CAUTION': 'Provisional headers are shown',
'Access-Control-Request-Headers': 'accept, content-type',
'Access-Control-Allow-Methods': 'GET,POST'
})
but still I'm getting CORS problem while I was running in Firefox
and the error I'm getting is
Accept
*/*
Accept-Encoding
gzip, deflate
Accept-Language
en-US,en;q=0.5
Access-Control-Allow-Cred...
true
Access-Control-Allow-Orig...
http://www.webservicex.net
Cookie
_ga=GA1.1.256593039.1431427019
Host
localhost:8383
Referer
http://localhost:8383/CordovaApp/index3.html
User-Agent
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0