0

Click on a div inside a menu on left side I load a specific file from chaptersfolder inside a div on the riht side.

<div id="menuLeft">
<div id="file01">File 01</div>
<div id="file02">File 02</div>
<div id="file03">File 03</div>
</div>

js

$("#menuLeft div").click(function () {
var id = "chapters/" + $(this).attr('id') + ".php";
$('#divRight').load(id);
});

This works, but I need to send various links to my friends, i.e. links to various files (file01, file02...) displayed automatically when the link is accessed.

So, is there a way to execute this js with various id parameter via url ?

qadenza
  • 9,025
  • 18
  • 73
  • 126

1 Answers1

2

Pass a hashtag to the url and use it as a file name.

http://your-url.com/somefile.php#file01

and then:

var file = window.location.hash;
//then you load your file via js
Ivanka Todorova
  • 9,964
  • 16
  • 66
  • 103