I'm trying to use a third-party web service to get data, using ajax. The guys, providing the web service gave me a link and a small description on how to get the data and i feel i'm close, but i can't get it to work. So here's what they gave me:
Production URL: 'http://www.locationbasedtech.net/webservice.asmx' Call: getDeviceData(string username, string password, string activationCode)
The function is supposed to return a JSON response, or some of the following error codes: -1 ; -1001; -2001; -3001;
$.ajax({
url: '//www.locationbasedtech.net/webservice.asmx/getDeviceData?username=myusername&password=mypassword&activationCode=mycode',
contentType: "application/x-www-form-urlencoded",
dataType: "script",
success: function(data) {
console.log(data);//returns 'undefined' ??
},
error: function(request,status,errorThrown){
console.log(request+' '+status+' '+errorThrown);
}
}) ;
Now i've been able to make it work only with dataType: 'script'. All others return
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Anyway, the above-mentioned code works in means that i can see the correct (no errors json result) in the console link 'preview' or 'source', but the success function returns 'undefined'. How do i get that response?