当前位置:网站首页>Select trigger event from easyUI drop-down box
Select trigger event from easyUI drop-down box
2022-06-28 05:59:00 【Coder without code】
What I want to do is , First, find out the city name from the database , With json The format is passed to the front end , Front end use input A drop-down box , receive data , And display... In the drop-down box . Be careful , Front end transmission json The data format is fixed , The saved city format is List<map>,map There are two values in , One key by id,value For custom id( from 0 Start to grow ), the other one key by text,value For the name of the city . This is mainly written to correspond to the foreground drop-down box .
The front-end code :
<td> Select the city :
<input type="text" id="city_name" name="city_name" class="easyui-combobox" data-options="editable:true ,valueField: 'id',textField: 'text',url:'${pageContext.request.contextPath}/admin/main/getcity',prompt: ' The city name ',validType:'length[0,100]' "/>
</td> Then you need to get the click event . $(function(){
$("#city_name").combobox({
onSelect:function(record){
var cit=$("#city_name").combobox('getText');
$.ajax({
type:"POST",
url:'${pageContext.request.contextPath}/admin/main/getCityst',
dataType:"json",
data:{
"city":cit
},
success:function(json){
$("#version").text(json.version);
$("#lianjie").text(json.cstatus);
$("#qiantai").text(json.qstatus);
$("#xyzsl").text(json.alls);
$("#wljsl").text(json.noda);
}
})
}
}) according to id Get dropdown , then onSelect Get the selected drop-down box column , Then you can get the selected city . according to id, Use combobox,getText Get the city name , Then execute the front desk according to the name of the city ajax, Get other data under the city . 边栏推荐
猜你喜欢

How the third-party libraries in cocoapod reference local header files

YYGH-6-微信登录

Xcode13.3.1 error reported after pod install

Apple MDM bypass jailfree bypass MDM configuration lock free

Jenkins持续集成1

How popular are FB and WhatsApp mass messages in 2022?

Openharmony gnawing paper growth plan -- json-rpc

YYGH-BUG-02

19 fonctions de perte d'apprentissage profond

High quality domestic stereo codec cjc8988, pin to pin replaces wm8988
随机推荐
windows上安装redis并永久修改密码,及ssm框架集成redis
2022年全国职业院校技能大赛“网络安全”竞赛试题官方答案
Taobao seo training video course [22 lectures]
numpy. reshape, numpy. Understanding of transfer
MR-WordCount
@The reason why the Autowired annotation is empty
Mosaic data enhanced mosaic
数据中台:数据治理的七把利剑
【无标题】
使用SSM框架,配置多个数据库连接
移动广告发展动向:撬动存量,精细营销
Cryptography notes
Capacity scheduling absolute value configuration queue usage and pit avoidance
Oracle fundamentals summary
Sharing tips for efficient scripting
【MYSQL】所有查询表中有2千万数据--sql如何优化
Academic search related papers
原动力×云原生正发声 降本增效大讲堂
Jenkins继续集成2
脚本语言和编程语言