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

  • Home
  • SEARCH
  • 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 5841091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:50:38+00:00 2026-05-22T11:50:38+00:00

My project uses jQuery 1.4.2. I’ve got some security information that I add to

  • 0

My project uses jQuery 1.4.2.
I’ve got some security information that I add to my AJAX headers…
The way I’m doing this is by using $.ajaxSetup(), and setting a beforeSend function.

$(document).ready(function (e) {
    $.ajaxSetup({
        global: true,
        beforeSend: function (jqXHR, settings) {
            var verificationToken = 'some encrypted string';
            jqXHR.setRequestHeader("X-Request-Verification-Token", verificationToken);
        }
    });
})

As I understand it, this should then execute every time I make a call to $.ajax(), right?
It works fine in Chrome, Firefox, IE9, and so on, but occasionally not in IE7/8.

Here’s where I call it:

$.ajax({
    type: "POST",
    async: true,
    data: 'somedata',
    url: "/some/url",
    success: function (data) {
        alert("success");
    },
    error: function (data) {
        alert("error");
    }
});

I’ve found a workaround, which is to add the beforeSend directly to the $.ajax() call (below), but I really want to do this globally, rather than have to add it to loads of places in the code…

$.ajax({
    type: "POST",
    async: true,
    data: 'somedata',
    url: "/some/url",
    success: function (data) {
        alert("success");
    },
    error: function (data) {
        alert("error");
    }
    beforeSend: function (jqXHR, settings) {
        var verificationToken = 'some encrypted string';
        jqXHR.setRequestHeader("X-Request-Verification-Token", verificationToken);
    }
});

Any clues?

Thanks!
Neil

  • 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-22T11:50:39+00:00Added an answer on May 22, 2026 at 11:50 am

    Ok, in the absence of any other answer, I hereby declare this to be a bug in JQuery 1.4.x.
    The solution is to upgrade to a later version of JQuery, which sadly isn’t possible for me.

    If anyone has any better answer/fix, I’ll happily delete this one, and mark theirs as correct.

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

Sidebar

Related Questions

I'm working on a legacy groovy project that uses jQuery's password strength validator plugin
Hai, I've got a project which uses jQuery 1.2.1, and I cannot update the
I have an Asp.net MVC project that modestly uses jQuery scripts. My views also
Project I'm working on uses jQuery. I have a series of Ajax calls being
I have a web page that uses jquery ajax to grab the table markup
We just started a new ASP.Net project that uses web services to serialize some
I am working on a project that uses the jQuery library but we do
The ampoule project uses some tags in docstring, like the javadoc ones. For example
I inherited a project that uses SQL Server 200x, wherein a column that stores
I have Midas project that uses a TDataSetProvider in one of RemoteDataModules in the

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.