I have a search form that show live results in a specified div (look at there Filter results with Jquery)
I ve modified the script a little bit and now when a user check one of the checkboxes the results div automatically refresh. The load function is handled by onChange event.
Is there a way to get ajax loading the result script after a specified time?
For example, if I select one checkbox the script should wait 2 seconds before load the script. In this way an user can check, for example, 2 or 3 checkboxes and when it stop to make his selection ajax will load the script.
--edit--
The ajax call for the script isn t done through a function, this is the code:
$(document).ready(function()
{
$( #category_filter ).click(function()
{
var catArray = new Array();
var j = 0;
for(var i = 0; i < <?php echo $categories_count;?>; i++)
{
if(document.category_filter.filter_id[i].checked == 1)
{
catArray[j] = document.category_filter.filter_id[i].value;
j++;
}
}
if(catArray[0])
$.ajax(
{
type: "POST",
url: "index.php?action=ticket-search",
data: ({ filter: category ,filter_id : catArray.toString() }),
success: function(msg)
{
$( #t_content ).html(msg)
.hide()
.fadeIn(700, function() {});
}
});
});
});
});