Jquery load function does not work [closed]

0

Even following the official Jquery documentation, my script does not work. Something from day to day. I do not know if I changed something without wanting to.

Follow the code below

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>load demo</title>
  <style>
  body {
    font-size: 12px;
    font-family: Arial;
  }
  </style>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script></head><body><b>Projects:</b><olid="new-projects"></ol>

<script>
$( "#new-projects" ).load( "load.html #projects li" );
</script>

</body>
</html>
  • I've already changed the Jquery file to the latest one.
  • I tried different browsers
  • I have checked similar topics (not so similar)

Is there any restriction on AJAX to load static pages? I do not know what is happening. I do not want to run a page dynamically next to the server (php) because I'm developing an html5 application for mobile. I know there are ways to run php on a smartphone. I do not want it!

    
asked by anonymous 15.12.2016 / 21:08

2 answers

3

It does not work if you are opening the file directly from disk.

The protocol does not support Cross-Origin , you can only execute this example using a http server

Reference response: link

    
15.12.2016 / 22:16
0

Problem solved! Cause: Unaware of AJAX. For a misinterpretation I had of the AJAX technique, I associated it only as a client-side. What is not true. It was only I put in the Apache server folder that worked. For those who have the same problem, know that this Jquery function does not work outside a server.

About AJAX link

About the Jquery Load function link

    
16.12.2016 / 19:57