I have many <a href>
on my page to generate link like http://localhost/ozania/order.php?cat_id=DS01
"DS01"
is ony an example..
So I want to get values that every link I pressed (in the same page)
function getCAT(){
$.ajax({
type: "GET",
url: "order.php",
data: {
cat_id: 'cat_id'
},
success: function(response){
$("#category").text(""+response+"");
timer = setTimeout("getCAT()",5000);
}
});
}
$(document).ready(function(){
getCAT();
});
and print the result in <span>
like
<span id="category"></span>
but it always printed as nothing....
every i pressed the link, it is not reloading page because i use that script like
<a onclick="window.history.pushState('', '', '?cat_id=<?php echo $row['category_item']; ?>');"><?php echo $row['name_item'];?> </a>
So finally I want to print the link values every link I pressed with AJAX and preventing pages to reload.