I want to send a ajax request using post method with the XML as a response text, Is it possible, If it is possible please let me know the possible way for it.
For Ex
url : "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate"
data : {FromCurrency:"INR",ToCurrency:"AUD"}
method : GET or POST
http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=INR&ToCurrency=AUD
I need the response of this URL using ajax.
You can use YQL ,
var url = 'http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=INR&ToCurrency=AUD'; // website you want to scrape
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from xml where url="' + url + '"') + '&format=json&callback=?';
$.getJSON(yql,function(data){
if(data.query.results){
var result = data.query.results.double.content.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '');
alert(result);
}
});
You can write your own script on server on the same domain that does request to the webservicex.net and returns data in any format that you want.
So, ajax request -> your server (on the same domain) -> webservicex.net
It seems that server does not support CORS. Then you won't be able to do this with an ajax call due to the same origin policy
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.