I have an ajax checkbox that displays data or removes products depending on which boxes are checked. I’m facing two issues
-
If I manually deselect all checkboxes the last set of products always show
-
I have a deselect all function that deselects all checkboxes but the products still remain in the view
Looking at firebug I can see the "GET URL" still has all the selected checboxes inside the URL even tho none of my chekboxed have the tick sign (none are checked).
I want to know if there’s a way I can delete/remove the GET URL, so when I deselect all the URL is just the page address.
e.g.
That’s when some items are selected, if I use deselect all that URL doesn’t change so my products still show, basically I need a
function that will result in
Below is my JS code
Yii::app()->clientScript->registerScript('search',
"var ajaxUpdateTimeout;
var ajaxRequest;
$('.pro').change(function(){
products = $('.pro').serialize();
$.fn.yiiListView.update(
'ajaxListView',
{data: products}
);
});
$('#selectAll').click(function(){
$('.pro').attr('checked','checked')
products = $('.pro').serialize();
$.fn.yiiListView.update(
'ajaxListView',
{data: products}
);
});
$('#selectNone').click(function(){
$('.pro').removeAttr('checked')
products = $('.pro').serialize();
$.fn.yiiListView.update(
'ajaxListView',
{data: products}
);
});
"
);
Thanks in advanced