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 8168841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:39:38+00:00 2026-06-06T20:39:38+00:00

This answer has helped me largely but hasn’t fully resolved my issues. I’m using

  • 0

This answer has helped me largely but hasn’t fully resolved my issues. I’m using code similar to that, which is:

function getResponse() {

    var the_url = "http://www.myurl.com/api/get";

    $.ajax({
      url: the_url,
      dataType: 'jsonp',
      type: 'get',
      success: function(data) {
        var json_response = data;
        alert(data);
      }
    });
}

Basically, instead of just posting a url I need to post a curl because of authentication.

The example works fine with the simple url, but what I am wanting to use for ‘the_url’ is this:

var the_url = 'curl -u username:password "http://www.myurl.com/api/get"';

This is where I am having issues which means the success statement is never reached.

What is the best way to resolve this, and if it’s not achievable could someone recommend the best workaround?

Thanks in advance.

  • 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-06T20:39:39+00:00Added an answer on June 6, 2026 at 8:39 pm

    If you were using simple AJAX, then you could just add custom (basic authentication) header at the begining of your AJAX call. But you are using JSONP, which actually is equivalent to adding <script> tag to your HTML.

    So what you are asking is: can I do basic authentication with <script> tag? No, you can’t.

    The only possibility left for you is to do server side processing, like Matt Gibson suggested.

    Note however, that the browser should fire authentication dialog after the JSONP request (also see this answer). Isn’t it working in your case??

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

Sidebar

Related Questions

I am sure that the answer to this has been posted before. Forgive me
This question already has an answer here: view sql that linq-to-sql produces 3 Answers
An answer to this question has led me to look into using Event Tracing
There are a few questions that approach an answer to this question, but none
I now this has been asked a thousand times but that doesn't help me
I just read on this answer (answer has since been removed) and I'm sure
This StackOverflow answer has an image of KDiff3 highlighting intra-line differences. Does someone know
I read this answer on SO: Because the recursive mutex has a sense of
I've seen this answer, and I wonder (I hope) if C++11 has come up
Someone has an answer to this missing feature in Entity Framework. Does anyone have

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.