0
<button style='background-color:red;' onclick="$('#login').load('content/playasguest.html');">Play as guest</button>

Hi guys I have this website code. I want to on click on button load entire content of file and unload the content what is there. Function load is perfect on it but it dont t do anything. I can use .html but I have that code in different folder.

My folders :

client/
  content/
   login.html
   playasguest.html
   register.html
  index.html

So path to file is good Can anyone tell me whats the problem ?

Filip Bartoš
  • 301
  • 3
  • 16
  • did you check what error is coming on browser console? – Arpit Srivastava Jan 31 '17 at 18:09
  • Are you getting any console errors? Is your button inside a form? – Dave Jan 31 '17 at 18:11
  • jquery.js:4 XMLHttpRequest cannot load file:///C:/Users/Filip/Documents/NetBeansProjects/temponary_rush/client/content/playasguest.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource. this error shows up what does it mean ? – Filip Bartoš Jan 31 '17 at 18:13
  • Oh I solved it. I created it on my xampp server :) Thanks guys – Filip Bartoš Jan 31 '17 at 18:18
  • Possible duplicate of ["Cross origin requests are only supported for HTTP." error when loading a local file](http://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local) – Dave Feb 01 '17 at 03:40

0 Answers0