Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    May 2020
    Posts
    1
    Member #
    61658

    Uncaught SyntaxError: Unexpected token '<' I'm a Begginer to brackets

    Hello I'm trying to process an API call.
    I've written the API request code in html in brackets.
    I'm a novice.

    Getting the message
    Uncaught SyntaxError: Unexpected token '<'

    See below the Code I've written.
    What have I done wrong? Please note I've substituted my API key in the below.


    <!doctype html>
    <html>
    <script>
    //GET https://api.whale-alert.io/v1/status...r-api-key-here

    var burl = 'https://api.whale-alert.io/v1/';
    var endpoint = 'status?';
    var parameters = 'api_key=N#####VIlX8zb!9ZL';

    var url = burl + endpoint + parameters;

    request ('GET' ,url).
    then((r1) => {
    //SPECIFIY THE CODE TO HANDLE API RESPONSE
    console.log(r1);
    }).
    catch((err) => {
    console.log(err);
    })

    function request (method, url) {
    return new Promise(function (resolve, reject) {
    var xhr = new XMLHttpRequest();
    xhr.open(method, url);
    xhr.onload = resolve;
    xhr.onerror = reject;
    xhr.send();
    });
    }

    </script>
    </html>

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:56 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com