functionto $_POST url constructed with js method 02

This commit is contained in:
jorge 2023-01-12 09:07:06 +01:00
parent e03b38f8e8
commit 99b0a39d3f
1 changed files with 6 additions and 7 deletions

View File

@ -100,7 +100,8 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
(function($) { (function($) {
// change // change
$('#archive-filters').on('change', 'input[type="checkbox"]', function(){ //$('#archive-filters').on('change', 'input[type="checkbox"]', function(){
$('#archive-filters').on('click', 'button', function(){
// vars // vars
var url = '<?php echo home_url('ajuts/'); ?>'; var url = '<?php echo home_url('ajuts/'); ?>';
@ -112,19 +113,17 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
// vars // vars
var filteredajuts = $(this).data('filter'), var filteredajuts = $(this).data('filter'),
vals = [], vals = [],
allvalueschecked = ''; allvalueschecked = [];
// find checked inputs // find checked inputs
$(this).find('input:checked').each(function(){ $(this).find('input:checked').each(function(){
vals.push( $(this).val() ); vals.push( $(this).val() );
var thisvaluechecked = $(this).val(); var thisvaluechecked = $(this).val();
allvalueschecked += thisvaluechecked + ',';
urldos += filteredajuts; urldos += filteredajuts;
alert( urldos +"=" +allvalueschecked);
}); });
// append to args // append to args
args[ filteredajuts ] = vals.join(','); args[ filteredajuts ] = vals.join(',');
alert( filteredajuts +'=' +args[ filteredajuts ]);
}); });
// update url // update url
@ -141,10 +140,10 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
url = url.slice(0, -1); url = url.slice(0, -1);
// reload page // reload page
$('#archive-filters button').on('click', function () { //$('#archive-filters button').on('click', function () {
alert( "estoy en: " +url ); alert( "estoy en: " +url );
//window.location.replace( url ); //window.location.replace( url );
}); //});
}); });