FollowMee Forums   Home    Forums    Active Topics    Search
    Login
FollowMee Forums >> General Discussion >> General Discussion >> CORS error in followmee tracker API
CORS error in followmee tracker API
Author Topic
Pinky Moorjani


Newbie

Join Date: 2020-07-05
Posts: 1

Posted: 2020-07-18 07:10:43 AM

I am receiving CORS error while using followemee tracker API to track device
location

I am using Angular 6.

Can anyone help?
Administrator


Best of the Best


Join Date: 2010-01-27
Posts: 1383

Posted: 2020-07-18 09:08:23 AM

If you use ajax to call the api, you can use jsonp data type overcome the CORS issue. This is the code.

Code:

$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url: url,
async: false,
dataType: "jsonp",
success: function (data) {
var cont = true;
if (data.Error != null) {
alert(data.Error);
cont = false;
}

if (cont) {
buildHtmlTable(data.Data);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(''''Unexpected error has occurred: '''' + XMLHttpRequest.statusText + '''' ('''' + XMLHttpRequest.status + '''')'''');
}
});


For the complete code, see the source of this page.
http://www.followmee.com/api/testapi.html


  FollowMee.com