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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:01:13+00:00 2026-06-01T05:01:13+00:00

For the normal ajax request I use: strtolower($_SERVER[‘HTTP_X_REQUESTED_WITH’]) == ‘xmlhttprequest’ But this don’t work

  • 0

For the normal ajax request I use:

strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'

But this don’t work with cross domain request.

How can I do?

  • 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-01T05:01:15+00:00Added an answer on June 1, 2026 at 5:01 am

    Edit2:
    If you’re using jQuery.ajax function in this way:

    var request = $.ajax({
    url: "http://somesite.com/somescript.php?somevar=somevalue",
    dataType: "jsonp",
    jsonp: 'callback',
    success: function(data) {
    alert('Done!');
    }
    });
    

    Then you can check the $_SERVER['REQUEST_URI'] variable, or simply $_GET['callback'] and $_GET['_']. The REQUEST_URI will look like this:

    /somescript.php?somevar=somevalue&callback=jQuery172028849187534502896_1333494007273&_=1333494443880

    Edit: The answer below is to find out if it is cross-domain or not, not checking if it is AJAX

    The answer to the question “How to determine if an ajax-call is from a different domain” is this:

    I’m using the jQuery.ajax call, and for me using the variable $_SERVER['HTTP_REFERER'] works fine.

    If I’m using a page on my local computer, this superglobal returns an empty string.

    If I’m using a page on the internet, the value of $_SERVER['HTTP_REFERER'] returns the URL of the page that made the ajax call. So checking the value of this can tell you what you need to know.

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

Sidebar

Related Questions

I am using JQuery to perform form submission through an ajax request. I use
I'm using jQuery and use $.ajax to send out request. My computer is pretty
How can I tell jQuery to automatically use jsonp for cross-domain ajax requests while
Sending request to action using Ajax, the result type is json. Use a json
is there a way to differentiate ajax call and normal browser request in php
i'm just sending a normal POST request using Ajax.BeginForm... i output the form elements
I'm attempting to use AJAX to insert data into a database, but am unable
My normal work flow to create a new repository with subversion is to create
Generating normal columnar data in excel file is quite easy but does any one
A normal UserControl looks like this in XAML: <UserControl x:Class=mynamespace.foo ...namespaces...> <!-- content -->

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.