0

I have this markup for my index.html

<html>
     <head>
         <title>Jquery Ajax</title>
         <script src="jquery.js"></script>
         <script>
             $(document).ready(function(){
             $('button').click(function() {
                 $('#result').load('ajax/about.html');
             });
             });
         </script>
     </head>

     <body>
         <button>Click me</button>
         <div id="result">Hel</div>
     </body>
</html>

and in my about.html I have a simple text. When I click the button nothing happens. Consider that I have used $.get, too. but it does not works. Can someone help?

Nikola
  • 14,888
  • 21
  • 101
  • 165
user3631047
  • 3,256
  • 5
  • 23
  • 34

1 Answers1

1

If your working locally you may have issues if your using chrome try firefox instead or launch chrome like this

Mac

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-file-access-from-files

Windows

open /Applications/Google\ Chrome.app --args --allow-file-access-from-files

If your docs are all online then make sure your both files are on the same domain

Also if your using php i think you can add this

<?php header('Access-Control-Allow-Origin: *'); ?>

but make sure you remove it before going live

Dominic Green
  • 10,142
  • 4
  • 30
  • 34