You are violating the same origin policy. You cannot send an AJAX request to a remote domain. If you want to consume an ASMX web service from javascript using AJAX, this service must be located on the same domain as the page containing this script.
You seem to have specified dataType: 'jsonp'
in your request but this doesn't make any sense if the remote ASMX service is not configured to support JSONP
.
As a possible workaround you could write a new PHP script that will act as a bridge between the local and the remote domain and then send the AJAX request to the PHP script. This script will then call the remote web service by sending an HTTP request and return the result:
$.ajax({
type: 'POST',
url: '/CelsiusToFahrenheit.php',
success: function(data) { alert('ok') },
error: function(e) { alert('error') }
});
The CelsiusToFahrenheit.php
script that you need to write then will delegate the call to the remote domain to invoke the actual ASMX service. There are gazillions of
tutorials out there about how to call an ASMX web service with PHP. Here's one: Call asp.net web service from PHP with multiple parameters.