I'm kinda confused how to solve this problem in a right way..
This is jQuery function I intend to use. Runs on 1.7.2 jQuery, PHP 5.2.
$(function() {
var timer = setInterval( showDiv, 5000);
//var categoryid = ;??
function showDiv()
{
$.post("check4_new_data.php?categoryid="+encodeURIComponent(categoryid),
function(response)
{
$('#awaiting').fadeOut(400); //cosmetics, nothing important
$('#posting1').html(unescape(response));
$('#posting1').fadeIn(200);
});
}
});
Question:
There is a PHP variable $categoryid
set when PHP page loads and.. this function needs it. So, how to send $categoryid
back to jQuery in a right, safest way?
Note:Ive been using cookie as first test to keep categoryid
present for PHP, but then all opened (and different) pages started to load up same data (according to latest page visited).
Thx!