I have the following Code :
<ul>
<li>
<a href="index.php?page=quiz" class="cat" >
<h3>Category 1</h3>
<p>(explain here)</p>
</a>
</li>
<li>
<a href="index.php?page=quiz" class="cat" >
<h3>Category 2</h3>
<p>(explain here)</p>
</a>
</li>
</ul>
What I need is to send the category number to the page index.php?page=quiz
via $_POST or anything else
without sending it via $_REQUEST like this index.php?page=quiz&cat=1
OR assigning the category number value to a $_SESSION variable according to current clicked link
to get the value at destination page index.php?page=quiz.
I have already tried this solution:
javascript by sending the variable value to the page
var num=1; /*or put the current clicked category number */
$.ajax({
url: 'index.php?page=quiz',
type: 'post',
dataType: 'json',
data: {
category_no: num,
}
})
There seems to be a problem with the sending process and the value of page=quiz
is not send to the destination and we are still on the current page where page=home.
Do you have any helpful ideas?
NOTE: My problem is not getting the category id from current clicked (button/link) to javascript, but sending it to destination page with any of the ways mentioned above.