I have numerous books stored in text files.
I've created an index for these books on a website.
The idea is: To load a specific part of a book from the index by retrieving it from a text file containing the entire book.
INDEX OF THE BOOK(for example with 3 indexes):
<ul>
<li><a onClick="return LoadThis('a1')">INDEX-1</a><div id="loader1" ></div></li>
<li><a onClick="return LoadThis('a2')">INDEX-2</a><div id="loader2" ></div></li>
<li><a onClick="return LoadThis('a3')">INDEX-3</a><div id="loader3" ></div></li>
</ul>
The JavaScript Code:
var loadUrl = "http://www.website.com/books/the-book.php";
function LoadThis(link_anchor)
{
var loader="#loader"+link_anchor.substring(1);
$(loader).html(ajax_load).load(loadUrl+" #"+link_anchor);
$(loader).addClass('ajax-active');
}
The-Book.PHP file
<div id="a1"><p>Index-1 texts...</p></div>
<div id="a2"><p>Index-2 texts ....</p></div>
<div id="a3"><p>Index-3 texts ....</p></div>
Issue: Loading times can be slow, especially as the number of indexes and the size of The-Book.php file increases.
Question: Is my current AJAX LOAD function programming method considered standard?
Are there more efficient, standardized, and faster methods to achieve this task?
Your assistance is much appreciated.