Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
Sign in to follow this  

Output connection from API


Posted (edited)

Site URL: https://www.maestros-online.com

Hi all,

Very new to web design so apologies if this is a basic question. I'm looking to have my site display currencies in plain text on the home page. For now, I just want to be able to fetch the visitor IP and produce a symbol based on the location. IP Stack has a free API that I can use, and looking through the documentation, I assume I need to inject this code into the header script to log in and fetch the Symbol variable:

  // set endpoint and your access key
var ip = ''
var access_key = 'APIKEY';

// get the API result via jQuery.ajax
    url: 'http://api.ipstack.com/' + ip + '?access_key=' + access_key,   
    dataType: 'jsonp',
    success: function(json) {

        // output the "symbol" object inside "currency"


So I have an alert - json.currency.symbol, but how would I then print this in the text? I assume I need to create a source code block, and then do something like:


var output = document.getelementbyID('output');
output.innerHTML= json.currency.symbol;



Am I anyway near on this?


Thanks for the help

Edited by SolidSnake100
right info

Share this post

Link to post

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in to follow this  

  • Create New...