Forums Register Login

jquery GET External Rest Service

+Pie Number of slices to send: Send
Hi, I am invoking "GET" method for local restful services from jquery with success. But when I try an external service, I do not make it work.

<script type="text/javascript">
$.ajax({
type: "GET",
dataType: "text/xml",
url: "http://www.webservicex.net/geoipservice.asmx/GetGeoIP?IPAddress=158.42.38.1",
success: function(data){
alert("Working");
},
error:function(res){
alert("Not working ");
}
});
</script>

Does anybody see where is the error?
Thanks a lot
+Pie Number of slices to send: Send
What have you done to insure that the URL you are using is correct?

Bill
+Pie Number of slices to send: Send
I have tested it with the chrome plugin for rest client and it works.
+Pie Number of slices to send: Send
Please explain what you mean by "do not work". Read ItDoesntWorkIsUseless.
+Pie Number of slices to send: Send
It means I get an error message; if I show res.statusText it just says "error".
+Pie Number of slices to send: Send
With chrome debugger I got the error is [...] Origin is not allowed by access-control-allow-origin. However I made it work for a different external service.
I tried to add, for this service, "Access-Control-Allow-Origin: "*"," to the Ajax code, but it does not seems to be the correct way to do it.
Slime does not pay. Always keep your tiny ad dry.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1216 times.
Similar Threads
change event is firing twice
Async jquery invocation to rest service
jquery POST XML to Rest service
Uncaught SyntaxError: Unexpected token < when calling java SOAP webservice
not rendering alert when focus is out of text box
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 00:21:39.