Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 选择2-一旦选择该选项,打开由wp json发送的URL_Javascript_Jquery Select2 - Fatal编程技术网

Javascript 选择2-一旦选择该选项,打开由wp json发送的URL

Javascript 选择2-一旦选择该选项,打开由wp json发送的URL,javascript,jquery-select2,Javascript,Jquery Select2,我的Wordpress使用select2库通过使用WP Rest API显示类别列表下拉列表。我正在使用select2在选择选项后是否有任何方法触发操作 这是我的密码: jQuery(文档).ready(函数($){ $('.pronamic wp posts example')。选择2({ allowClear:是的, 最小输入长度:2, 阿贾克斯:{ 网址:'https://demo.wp-api.org/wp-json/wp/v2/categories', 数据类型:“json”, 数据

我的Wordpress使用select2库通过使用WP Rest API显示类别列表下拉列表。我正在使用select2在选择选项后是否有任何方法触发操作

这是我的密码:

jQuery(文档).ready(函数($){
$('.pronamic wp posts example')。选择2({
allowClear:是的,
最小输入长度:2,
阿贾克斯:{
网址:'https://demo.wp-api.org/wp-json/wp/v2/categories',
数据类型:“json”,
数据:函数(参数){
返回{
搜索:params.term
};
},
processResults:函数(数据){
返回{
结果:jQuery.map(数据,函数(obj){
返回{id:obj.id,text:obj.name};
} )
}
}
}
} );
} );