Matarishvan
Matarishvan

Reputation: 2422

Cannot able to call this API - AJAX

I am trying to call this SMS API from 2factor

This is the code, I am getting CORS issue

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://2factor.in/API/V1/293832-67745-11e5-88de-5600000c6b13/SMS/991991199/AUTOGEN",
  "method": "GET",
  "headers": {},
  "data": "{}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Code can be found here - Sample Code How to make http get request with CORS enabled

Even if I use 'jsonp', I am getting

unexpected token ':'

How to solve this

Upvotes: 1

Views: 125

Answers (1)

Christian Esperar
Christian Esperar

Reputation: 528

You have 2 problems in you sample request, please check this first.

  1. Phone number needs to be 10 digits, you only pass 9 digits
  2. Invalid API key

Upvotes: 1

Related Questions