0

I'm having a problem and I don't know what I'm doing wrong. I have a button (menu link) that I'd like to click to load file content into said div. When I click it in Dreamweaver live view it works without any problem, but it doesn't work in Chrome browser. JS works in Chrome, I've done a test jquery popup window.

jQuery:

<script type="text/javascript">
$(document).ready(function () {
    $('#loadPage').click(function(){
        $('.content').load( 'pages/tools/przesuniecie.html' );
    });
}); </script>

HTML:

<a id="loadPage" href="#">Test</a>

In Dreamweaver it works like it's supposed to be. On button click it loads przesuniecie.html content into content div.

Thanks for any help

Darthenn
  • 3
  • 4
  • any errors in your browser console? – Michael Coker Jun 04 '17 at 18:39
  • "XMLHttpRequest cannot load (przesuniecie page). Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https." – Darthenn Jun 04 '17 at 18:46
  • Are you just opening the HTML in chrome locally on your computer? Or is the site on a hosted webserver? – Michael Coker Jun 04 '17 at 18:54
  • I am opening it locally. – Darthenn Jun 04 '17 at 18:56
  • When I'm trying it on a local web server, the operation works. So it just doesn't work when I try to launch it directly as a html. – Darthenn Jun 04 '17 at 19:05
  • Is there an alternative that I could use so it would work locally without any web server? – Darthenn Jun 04 '17 at 19:28
  • Use the search :) https://stackoverflow.com/questions/19902538/loading-local-files-with-javascript-without-a-web-server – Michael Coker Jun 04 '17 at 19:37
  • Thanks. I cannot use that method then, because I need it to run locally without any web server or change in the browser. Is there a jquery method I could use to replace div with menu onclick? Let's say I have 5 menu items and they should redirect to 5 different div with content. Clicking on each hides all the other ones and shows only the one that I clicked on. – Darthenn Jun 04 '17 at 20:18
  • like this? https://jqueryui.com/tabs/ if not, make your best attempt, and make a new post asking for help. Feel free to ping me here if you do. – Michael Coker Jun 04 '17 at 20:45
  • 1
    Thank you. I managed to get sort the content with use of menu and jquery tabs like this. Everything is stored in one file and browsers now allow it without any problem. – Darthenn Jun 05 '17 at 14:07
  • That's awesome. You're welcome. – Michael Coker Jun 05 '17 at 15:45

0 Answers0