Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
How to read and load data from local file when page loads

I would like to load local file data & populate that data while page loads.

I tried to use this jquery function

<script type="text/javascript">
   jQuery(document).ready(function ($) {
       $("div.footerText").load("footerText.txt");
   });
</script>

But this results in following error

Access to XMLHttpRequest at 'file:////footerText.txt' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, edge, https, chrome-untrusted.

Basically I am trying to write a simple HTML page which loads data into different div by reading files that are in the same code base. here is rough structure of html

<head>...</head>
<body>
  <div id="headerText">
  <div id="mainText">
  <div id="footerText">
  <script type="text/javascript">

    jQuery(document).ready(function ($) {
        $("div#headerText").load("headerText.txt");
        $("div#mainText").load("mainText.txt");
        $("div#footerText").load("footerText.txt");
    });
  </script>
</body>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think you should not do that.. and that seems kinda impossible. Have a look at this QA for more details

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!