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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:04:24+00:00 2026-06-06T06:04:24+00:00

I have two development sites call api.localhost and game.localhost . Both are running from

  • 0

I have two development sites call api.localhost and game.localhost. Both are running from an old version of Apache which is the same as the one running on the physical server so I don’t want to change it unless I have to. I am also running an old version of PHP (again don’t want to update it unless I have to).

The issue is if I run a test page (reproduced below) on api.localhost it works fine. If I run the same page on game.localhost then it fails. At first I thought the failure was due to jquery.jsonrpc which is what I was using at the time so I reduced to to just using jQuery ajax calls. I reduced the response of the index.php file I was calling to a simple correct generic jsonrpc response. The actual ajax call comes from another SO question. The firebug console surprisingly says 200 OK after a red string of the requestand there is no response below it.

Things I have looked at:

  • Both sites have the same version of jquery on it.
  • The virtual hosts look okay. They only differ in the respect that the error log filenames are different.
  • There are nothing in the error logs except a lot of favicon errors.
  • The hosts file looks okay. Nothing unusual in there.

index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>test</title>
<head>
<body>
<script type="text/javascript" src="jquery.js"></script>
<script>
$(document).ready(function() {
    $.ajax({ 
        url: 'http://api.localhost/index.php',  
        data: JSON.stringify({jsonrpc:'2.0',method:'add', params:[1400,2100],id:"jsonrpc"}),  // id is needed !! 
        type:"POST", 
        dataType:"json", 
        success: function (result) {  
            alert("ok"); 
        }, 
        error: function (err,status,thrown) { 
            alert ("this syntax sucks!! " + " ERROR: " + err + " STATUS: " + status + " " + thrown ); 
        }, 
        complete: function (xhr,status) {  
            alert('Complete=>  showing status as: '+ status);  
            data = $.parseJSON(xhr.responseText);   
            alert (data); 
        }  
    }); 
});
</script>
test
</body>
</html>

api.localhost/index.php

<?php
print '{"jsonrpc": "2.0", "result": 19, "id": 1}';
?>

What is preventing the request from going ahead and being serviced?

  • 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-06T06:04:26+00:00Added an answer on June 6, 2026 at 6:04 am

    Same origin policy prevents you from making AJAX calls between subdomains.

    You can try adding this line to allow cross-subdomain requests:

    document.domain = "localhost";
    

    Another way is to use JSONP to get around the same origin policy.

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

Sidebar

Related Questions

I have now witnessed two companies move to agile development with Scrum. In both
I have two Web Sites running under IIS6 (Windows Server 2003R2 Standard), each bound
So I have two heroku apps: http://production-app.com (mapped from http://production-app.heroku.com ) http://development-app.heroku.com On production-app.com
We have two sites, and we've just now made an in-house development server that
I am working on client's application in which we have two servers - development
I have recently found those two look-alike solutions/IDE for cross-mobile development: Appcelerator and Rhomobile
I am just starting off Windows OEM development and have come across these two
I have two classes which need to be in same xml file. The way
I have some questions about how you set up your development environment. I'm running
I'm new to Rails development. I have two models, Decision and Choice. Every decision

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.