I have a array search_by_type
which is declared at the top. Now in every click I am setting the rest_type_id
value to array which is working fine.
Now other page action is calling get_all_restro()
function which will empty the array search_by_type
. When again I click restro_type_filter
class it print array which has a value that means it is not getting empty.
var search_by_type = new Array();
$(document).on("click",".restro_type_filter",function(){
console.log(search_by_type);
var rest_type_id = $(this).attr('rest_type_id');
search_by_type.push(rest_type_id);
});
function get_all_restro(type){
search_by_type.length = 0;
}
EDIT :
Ok guys there is an error at function get_all_restro() - Cannot set property 'length' of undefined
how should I solve this? Is this error is creating a problem ?
What is happening here, what I am doing wrong ?
Thanks in advance.