the jQuery function works and echoes the proper value
This commit is contained in:
parent
6959347849
commit
4f2630c4c1
|
@ -95,7 +95,6 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
// change
|
// change
|
||||||
//$('#archive-filters').on('change', 'input[type="checkbox"]', function(){
|
|
||||||
$('#archive-filters').on('click', 'button', function(){
|
$('#archive-filters').on('click', 'button', function(){
|
||||||
|
|
||||||
// vars
|
// vars
|
||||||
|
@ -109,11 +108,12 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
|
||||||
$('#archive-filters .filter').each(function(){
|
$('#archive-filters .filter').each(function(){
|
||||||
// check if is first appearance of each
|
// check if is first appearance of each
|
||||||
if( eachfiltered != $(this).data('filter') ){
|
if( eachfiltered != $(this).data('filter') ){
|
||||||
|
|
||||||
// save already calculated field=val01,val02,val03
|
// save already calculated field=val01,val02,val03
|
||||||
appendtoURL += eachfiltered +'=' +valueschecked +'&';
|
if( eachfiltered != '' && valueschecked != '' ){
|
||||||
// remove last ','
|
// remove last ','
|
||||||
appendtoURL = appendtoURL.slice(0, -1);
|
valueschecked = valueschecked.slice(0, -1);
|
||||||
|
appendtoURL += eachfiltered +'=' +valueschecked +'&';
|
||||||
|
};
|
||||||
// start new fieldname filtered
|
// start new fieldname filtered
|
||||||
eachfiltered = $(this).data('filter');
|
eachfiltered = $(this).data('filter');
|
||||||
// reset values
|
// reset values
|
||||||
|
@ -122,18 +122,20 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
|
||||||
$(this).find('input:checked').each(function(){
|
$(this).find('input:checked').each(function(){
|
||||||
// if not empty save value and ,
|
// if not empty save value and ,
|
||||||
if( $(this).val() != '' ){
|
if( $(this).val() != '' ){
|
||||||
valueschecked = $(this).val() + ',';
|
valueschecked += $(this).val() + ',';
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
//alert( appendtoURL +":" +eachfiltered +"=" +valuescheked);
|
||||||
} else {
|
} else {
|
||||||
// we have previous values checked
|
// we have previous values checked
|
||||||
// find checked inputs
|
// find checked inputs
|
||||||
if( $(this).val() != '' ){
|
//if( $(this).val() != '' ){
|
||||||
// if not empty append value and ,
|
// if not empty append value and ,
|
||||||
$(this).find('input:checked').each(function(){
|
$(this).find('input:checked').each(function(){
|
||||||
valueschecked += $(this).val() + ',';
|
valueschecked += $(this).val() + ',';
|
||||||
});
|
});
|
||||||
}
|
//alert( appendtoURL +":not:" +eachfiltered +"=" +valuescheked);
|
||||||
|
//};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -141,18 +143,12 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
|
||||||
appendtoURL += eachfiltered +'=' +valueschecked +'&';
|
appendtoURL += eachfiltered +'=' +valueschecked +'&';
|
||||||
|
|
||||||
// remove last &
|
// remove last &
|
||||||
appendtoURL = url.slice(0, -1);
|
appendtoURL = appendtoURL.slice(0, -1);
|
||||||
|
|
||||||
// update url
|
// update url
|
||||||
url += '?';
|
url += '?' +appendtoURL;
|
||||||
|
|
||||||
|
alert( url );
|
||||||
|
|
||||||
// reload page
|
|
||||||
//$('#archive-filters button').on('click', function () {
|
|
||||||
alert( "estoy en: " +url +appendtoURL);
|
|
||||||
//window.location.replace( url );
|
|
||||||
//});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue