mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-06-05 15:08:20 +09:00
37cbcc7210
js needs work
26 lines
700 B
JavaScript
26 lines
700 B
JavaScript
function tax_term_postback( select_id, taxonomy ) {
|
|
var data = {
|
|
action: 'tax_term_action',
|
|
taxonomy: taxonomy
|
|
};
|
|
jQuery.post(ajax_object.ajax_url, data, function(response) {
|
|
// Decode the data received.
|
|
var terms = jQuery.parseJSON(response);
|
|
|
|
// Keep track of what was previously selected
|
|
var select_ctrl = jQuery('#' + select_id);
|
|
var old_term = select_ctrl.val();
|
|
|
|
// Clear out the old options, build up the new
|
|
select_ctrl.empty();
|
|
jQuery.each(terms, function(key, value) {
|
|
var new_option = jQuery('<option></option>')
|
|
.attr('value', key).text(value);
|
|
if (value == old_term) {
|
|
new_option.attr('selected', true);
|
|
}
|
|
select_ctrl.append(new_option);
|
|
});
|
|
});
|
|
}
|