Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8530241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:12:53+00:00 2026-06-11T09:12:53+00:00

To start off, this is a cross-domain request I am trying to complete. Here

  • 0

To start off, this is a cross-domain request I am trying to complete. Here is a link to the Strava API whitepaper that I am using as a reference. Strava Wiki

Please see the code I am using below. If it is not possible to perform the request with jQuery, can you give me an example of another way to do it? (ex. AJAX) I’ve done my research but I admit that I do not know enough to understand why the request is not working. Do I need to insert an argument that waits for the response before displaying the alert, or is that implied? Thanks in advance!

 <html lang="en">
 <head>
   <meta charset="utf-8">
   <title>jQuery demo</title>
 </head>
 <body>
   <a href="http://jquery.com/">jQuery</a>
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
   <script>
        $(document).ready(function(){
            $("a").click(function(event){
                $.getJSON('http://www.strava.com/api/v1/segments/637215', function(data) {
                    alert(data);
                });
            });
         });
   </script>
 </body>
 </html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:12:54+00:00Added an answer on June 11, 2026 at 9:12 am

    For more information as to why your solution will not work as intended, please refer to: Access-Control-Allow-Origin Multiple Origin Domains?

    Try using the .ajax method instead with dataType: "jsonp":

    $.ajax({
       url: "http://www.strava.com/api/v1/segments/637215",
        dataType: 'jsonp',
        success: function(data){
            console.log(data);
         }
     });
    

    running this gets the following:

    {"segment":{"id":637215,"name":"Highway 33 Climb - Matilija Lake to Rose Valley","distance":16779.2,"elevationGain":1101.1,"elevationHigh":1070.9,"elevationLow":289.54,"averageGrade":4.64087,"climbCategory":"1"}}
    

    EXAMPLE

    Note that there does seem to be an error with the returned data, but I am able to see it. (Please see Musa‘s comment below).

    EDIT

    or you can change:

    $.getJSON('http://www.strava.com/api/v1/segments/637215', function(data) {
                        console.log(data);
                    });
    

    to:

    $.getJSON('http://www.strava.com/api/v1/segments/637215?callback=?', function(data) {
                        console.log(data);
                    });
    

    This will cause .getJSON() to use jsonp instead.

    If the URL includes the string "callback=?" (or similar, as defined by the server-side API), the request is treated as JSONP instead.

    EXAMPLE

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is more of a 2nd part of a question that start off here
I'm trying to start off using FBJS, and I can't figure this out. The
To start off, I have this XML file that contains recursive parent-child elements. Here
To start off, here is the JSON response that I've been working on: {
Ok this is a really weird problem. I wanna start off by saying that
Let me start off by saying that I am completely new with WPF (this
I know there's already plenty of threads that start off this way. I'm reading
I'm going to start this off by saying that I am new to GLSL
Let me start off by saying that this is my first real Cocoa app.
Let me start this off by saying that I'm an intern with no Powershell

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.