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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:39:24+00:00 2026-06-10T00:39:24+00:00

I have following code: var params = { cache:false, dataType:json, type:GET, url: /order.php, error:

  • 0

I have following code:

var params = {
            cache:false, 
            dataType:"json", 
            type:"GET",
            url: "/order.php",
            error: function(data){
                dump(data);
            },
            success: function (data){
              alert('ok');
            },
            data:{
                js:1
            }
        };

$.ajax(params);

So if I run example.com it gets work perfect.
But if I run http://www.example.com I get an error via my function dump().
Google console shows an error:

XMLHttpRequest cannot load
=1345470451769″>http://example.com/order.php?js=1&tariff=247&=1345470451769. Origin
http://www.example.com is not allowed by Access-Control-Allow-Origin

What does it mean?

So I don’t need any permanent redirect from http://www.domain.com to domain.com.

Thanks in advance for any help.

update 1:
I added function:

function getBaseUrl()
{
   var baseUrl = '';
   baseUrl += location.protocol + '//';
   baseUrl += location.hostname;

   return baseUrl;
}

and change url: “/order.php” on url: getBaseUrl() + “/order.php”

got the same error.
Am I doing something wrong here?

Update 2:
I added this one to htaccess file:

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin http://sample.com http://www.sample.com
</IfModule>

It seems my hosting doesn’t support it, because I still get an error for www.

  • 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-10T00:39:25+00:00Added an answer on June 10, 2026 at 12:39 am

    The error you’ve got there means that you can’t make a XMLHttpRequest from one domain to another unless the target domain specifies in its response header that you’re allowed to do this. It’s a security measure enforced by the browser.

    The entire domain has to match, so example.com can’t make a XMLHttpRequest request to http://www.example.com and vice-versa.

    You could just use some javascript to get the URL based on the current document location, or use relative paths instead.

    Also make sure the webserver isn’t doing a silent redirect from one domain to another as this may also cause permissions issues.

    The alternative if you have access to the webserver is to add the appropriate cross domain headers to the response – http://www.w3.org/TR/cors/

    Example:
    Access-Control-Allow-Origin: http://www.example.com http://example.com

    Edit: The domains in the above list need to be space separated, not comma.

    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "http://sample.com http://www.sample.com"
    </IfModule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following code to cache some expensive code. private MyViewModel GetVM(Params myParams)
I have the following javascript code: $(window).bind(scheduleComplete, (function (event, params) { var hallCount =
js undefined error we have the following widget code : index.html <script type=text/javascript language=javascript>
I have the following JavaScript code: var x = ['CFMG','JMFMG','CPMAF']; var y = $.param({'test':x});
I have the following code: var submitHandler = function ($link, $form, close) { var
I have the following code: var refreshId = setInterval(function() { $(#footad).html('myjshere'); }, 15500); Where
I have the following code: var carsContext = new CarsDataContext(); IQueryable<Car> allCars = carsContext.Cars;
I have the following code var dbvalue = Ned; var deleteLink = '<a href=#delete
I have the following code: var sl: THashedStringList; begin sl:= THashedStringList.Create; sl.Duplicates := dupIgnore;
I have the following code: var bool:String = true; Without an if block or

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.