Hi there.
Been trying my best to understand this correctly. What is the difference between an XML, SOAP and JSON response? And how does one know how to call a web service whose response is one of the above? (...Please correct me if I'm off-track)
The reason I ask this because I am trying to call a remote ASMX from jQuery within my .NET3.5 webapp, and no luck at all!! Basically I am trying to call a CurrencyConverter method as shown at this address: http://www.webservicex.net/CurrencyConvertor.asmx?op=ConversionRate
I can see that it returns XML, but the following code does not work:
$('#Currency').bind('change', function() {
var targetDiv = '#Result'
var currencyValue = $('#Currency option:selected').attr('value')
var webMethod = 'http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate'
var parameters = "{'FromCurrency':'GBP','ToCurrency':'" + currencyValue + "'}"
$(targetDiv).html('loading...');
$.ajax({
type: "POST",
url: webMethod,
data: parameters,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
$(targetDiv).html(response.d);
},
error: function(response) {
$(targetDiv).html("Unavailable:" + response);
}
});
});
Please could someone assist me with this, as I am really lost!
Thank you!