Issue
i m trying to use Rapiapi in my webapplication and trying to use the javascript code to get the name of cities and country by autocomplete but im getting error when i try to search. will anyone be able to help me please.
please find the detail code below
var settings = {
"async": true,
"crossDomain": true,
"url": "https://countries-cities.p.rapidapi.com/location/country/GB/geojson?format=json",
"method": "GET",
"headers": {
"x-rapidapi-host": "countries-cities.p.rapidapi.com",
"x-rapidapi-key": "65a1b9fb01mshdd797ad52c65502p1489acjsna4edfe314956"
}
}
$.ajax(settings).done(function(response) {
console.log(response);
});
function search() {
var input = document.getElementById('search-bar');
var allcities = new cities(input);
}
im trying to get the details of cities and country name as the user type in. T
Please help Thanks
Solution
I would suggest using their SDKs.
They provide the following snippet:
var request = require('request');
var options = {
method: '{{HTTP_METHOD}}',
url: '{{API_URL}}',
headers: {
'x-rapidapi-key': '{{API_KEY}}'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
Answered By - Createdd Answer Checked By - David Goodson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.