我正在尝试在http://s195004125.websitehome.co.uk/jobs/由于某些原因,当ios进行更改时,扇区选择框不会更新下面的列表,但当您选择其他位置时,它会更改,我已修改了扇区过滤器以包括以下部分:
<select id="sector" name="search_categories" value="<?php echo esc_attr( $categories ); ?>">>
<option value="">-- Please Select Sector --</option>
<option value="Building, Maintenance & Construction">Building, Maintenance & Construction</option>
<option value="Care & Support">Care & Support</option>
<option value="Housing">Housing</option>
<option value="Public Sector & Not for Profit">Public Sector & Not for Profit</option>
<option selected="selected" value="<?php echo $pull_sector; ?>"><?php echo $pull_sector; ?></option>
</select>
这方面的ajax是
if ( $search_categories ) {
$showing_categories = array();
foreach ( $search_categories as $category ) {
$category_object = get_term_by( is_numeric( $category ) ? \'id\' : \'slug\', $category, \'job_listing_category\' );
if ( ! is_wp_error( $category_object ) ) {
$showing_categories[] = $category_object->name;
}
}
$result[\'showing\'][] = implode( \', \', $showing_categories );
}
如有任何建议,将不胜感激。
最合适的回答,由SO网友:Aric Watson 整理而成
看起来只有您的位置下拉列表触发了ajax查询。我认为问题在于javascript列出了这些元素的更改事件:\'#search_keywords, #search_location, .job_types :input, #search_categories, .job-manager-filter\'
在下面的代码中(中的第178行http://s195004125.websitehome.co.uk/wp-content/plugins/wp-job-manager/assets/js/ajax-filters.js?ver=1.23.13)
$( \'#search_keywords, #search_location, .job_types :input, #search_categories, .job-manager-filter\' ).change( function() {
var target = $( this ).closest( \'div.job_listings\' );
target.triggerHandler( \'update_results\', [ 1, false ] );
job_manager_store_state( target, 1 );
} )
但是,元素的实际id是
sector
, 不
search_categories
- 也许可以尝试将“#扇区”添加到列出的元素中,以便javascript也在侦听其更改事件。