I have an issue using AJAX Dynamic loading a content in a div. I am creating an article page and I am loading only once the navigation header and footer and there is a div besides which loads the content from the rest of the pages. The problem is that I need to get the ID from the URL so I can get the data for each article, but because I am using this method of loading and in the URL is only the # to activate the AJAX Request.
Can someone suggest a solution how to retrive the ID, so I can keep using this way of loading cause it's cool ?
Cheers
Use the "data-id" for each one of your article link and set your article ID into it:
<a href="#" class="ajax" data-id="120">article link</a>
Before making an ajax request by jquery retrieve the the data-id value:
$("a.ajax").click({
var id=$(this).attr( "data-id" );
});