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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:09:09+00:00 2026-06-05T11:09:09+00:00

Because my title is too short, I will explain more clearer. I have create

  • 0

Because my title is too short, I will explain more clearer. I have create a code in JavaScript . And I have two options to run :

1) Run on machine : simple click into html file.

2) Run on local server : mean I start Apache, and start this html file in localhost.

( http://localhost:85/Javascript/index.html for example)

When I choose solution 1, no thing happen. And when I choose solution 2, happen as I wish. But I don’t know why.

Here is my code. Purpose : take a json file and process it.

<script>
        window.onload = function(){
            var url = "http://localhost:85/javascript/json1.json";  // problem here
            var request = new XMLHttpRequest();
            request.open("GET", url);
            request.onload = function(){
                if (request.status == 200){
                    update(request.responseText);
                }
            }
            request.send(null);
        };
function update(responseText){ // some code here }
</script>
  • 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-05T11:09:11+00:00Added an answer on June 5, 2026 at 11:09 am

    You cannot use AJAX to read content from a different domain.

    Javascript running from file://whatever cannot read localhost:85.

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

Sidebar

Related Questions

the title might be too generic, but I have a very specific question about
The title explains all... I have this snippet of code in my application: String
I hope the title isn't too confusing, I'll try to explain better below. Suppose
Hope the title wasn't too confusing. I have a directory full of files which
I'm not too great with jquery and maybe this title doesn't explain too well
The question title is a bit strange because I'm not exactly sure how to
I know the title sound confusing and thats because it is. its a bit
I have a problem as i've described in title. I've got menu and I
I have lists of articles made of: title, subtitle and body. Now I need
You read the title and groaned. That's okay. I did too. But we do

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.