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 ?

2

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

1 Comment

@Thanks, FakeHeal, I will try

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.