form filter based on jQuery works for archive-ajut.php category
This commit is contained in:
parent
4f2630c4c1
commit
de60c363e3
|
@ -79,8 +79,8 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
|
||||||
<?php }; //end if type checkbox ?>
|
<?php }; //end if type checkbox ?>
|
||||||
|
|
||||||
<?php }; //end foreach groupkey field ?>
|
<?php }; //end foreach groupkey field ?>
|
||||||
<p><b>Results:</b> <span id="results"></span></p>
|
<?php //echo '<p><span id="filterlink"></span></p>';?>
|
||||||
<button type="button" name="submit-ajut" class="button-more">enviar</button>
|
<p><a id="submitfilteredlink" name="submit-ajut" class="button button-more" href="">enviar</a> </p>
|
||||||
</form>
|
</form>
|
||||||
<?php //close the form and subit ?>
|
<?php //close the form and subit ?>
|
||||||
|
|
||||||
|
@ -95,7 +95,8 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
// change
|
// change
|
||||||
$('#archive-filters').on('click', 'button', function(){
|
//$('#archive-filters').on('click', 'button', function(){
|
||||||
|
$('#archive-filters').on('click', 'input', function(){
|
||||||
|
|
||||||
// vars
|
// vars
|
||||||
var url = '<?php echo home_url('ajuts/'); ?>';
|
var url = '<?php echo home_url('ajuts/'); ?>';
|
||||||
|
@ -139,6 +140,8 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// remove last ','
|
||||||
|
valueschecked = valueschecked.slice(0, -1);
|
||||||
// save last cycled filtered value already calculated field=val01,val02,val03
|
// save last cycled filtered value already calculated field=val01,val02,val03
|
||||||
appendtoURL += eachfiltered +'=' +valueschecked +'&';
|
appendtoURL += eachfiltered +'=' +valueschecked +'&';
|
||||||
|
|
||||||
|
@ -147,8 +150,13 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ):
|
||||||
|
|
||||||
// update url
|
// update url
|
||||||
url += '?' +appendtoURL;
|
url += '?' +appendtoURL;
|
||||||
|
|
||||||
|
// show or modify the url
|
||||||
|
//alert( url );
|
||||||
|
//$('#filterlink').text(url);
|
||||||
|
|
||||||
alert( url );
|
// convert a href url to new value
|
||||||
|
$('#submitfilteredlink').attr('href',url);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue