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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:20:40+00:00 2026-05-27T03:20:40+00:00

We are trying to pass credentials to our site via jquery ajax (not using

  • 0

We are trying to pass credentials to our site via jquery ajax (not using php [yeah I know this is unsafe]).

It seems Safari is having trouble with the username/password attributes of the ajax method. (jquery ajax) We are using jquery 1.5.1.

Here is example code:

$.ajax({
    url: "/some/url",
    type: 'GET',
    cache: true,
    dataType: 'json',
    processData: false,
    data: 'get=login',
    timeout: 7000,
    username: "user",
    password: "pass",
    success: function (data, textStatus, response) {
        Log("success");
    },
    error: function (data, textStatus, response) {
        Log("fail");
    }
});

This works fine in Firefox, Chrome, and IE7/8, but Safari won’t even send the ajax to the server (did a trace with wireshark and nothing is going down the pipe). Strangely enough, the error function gets called.

If I comment out username and password, the ajax is sent.

  • 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-05-27T03:20:40+00:00Added an answer on May 27, 2026 at 3:20 am

    I was able to fix this problem by using beforeSend and creating a request header. Apparently if this isn’t included, Safari chokes and doesn’t send anything. Here’s the code:

    $.ajax({
        url: "/some/url",
        type: 'GET',
        cache: true,
        dataType: 'json',
        processData: false,
        data: 'get=login',
        timeout: 7000,
        username: "user",
        password: "pass",
        beforeSend: function (req) {
            req.setRequestHeader('Authorization', "Basic " + btoa("user:password"));
        }
        success: function (data, textStatus, response) {
            Log("success");
        },
        error: function (data, textStatus, response) {
            Log("fail");
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to pass a dataString to to an ajax call using JQuery.
I am trying to pass login credentials to a PHP script that I have
I'm trying to pass in a Base64 string into a C#.Net web application via
I'm currently trying to pass a mono threaded program to multithread. This software do
I am trying to pass some Subsonic collections to a client via a web
I'm trying to connect in LDAP with php-ldap. I got a issue using ldap_bind()
I am trying to pass credentials to a website so I can use file_get_contents
I'm trying to validate a user's windows credentials on a computer that's not joined
I'm trying to pass a username and password variable to the twitter credentials but
I am trying to upload a file via ftp using FtpWebRequest as below: ftpRequest

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.