yii2中在view页面写js代码/城市联动
来源:互联网 发布:srt字幕制作软件 编辑:程序博客网 时间:2024/04/28 10:20
1.
<script><?php $this->beginBlock('js_end') ?>
$(document).on('change','.address',function(){
var area_id = $(this).val();
var _this = $(this);
_this.nextAll().remove();
if(area_id==0){
return false;
}
var url = 'index.php?r=test/area_child';
$.getJSON(url,{'area_id':area_id},function(msg){
if(msg.length>0){
var str="<selectclass='address'><option>..请选择</option>";
$(msg).each(function(k,v){
str+="<optionvalue="+v.area_id+">"+v.area_name+"</option>";
})
str+="</select>";
_this.after(str);
}
})
})
<?php $this->endBlock() ?>
</script>
<?php $this->registerJs($this->blocks['js_end'],\yii\web\View::POS_END); ?>
2.
<script src='css/jq.js'></script>
<script>
$(document).on('change','.address',function(){
var area_id = $(this).val();
var _this = $(this);
_this.nextAll().remove();
if(area_id==0){
return false;
}
var url = 'index.php?r=test/area_child';
$.getJSON(url,{'area_id':area_id},function(msg){
if(msg.length>0){
var str = '';
str+="<select class='address'><option>..请选择</option>";
$(msg).each(function(k,v){
str+="<option value="+v.area_id+">"+v.area_name+"</option>";
})
str+="</select>";
_this.after(str);
}
})
})
</script>
- yii2中在view页面写js代码/城市联动
- 城市二级联动js代码
- [yii2]-- [view] -- 在页面底部加载css和js
- JS城市联动菜单
- JS城市联动菜单
- JS 城市联动选择器
- js 城市三级联动
- js城市省份二级联动
- JS全国城市三级联动
- js全国城市三级联动
- 在代码中写view 的长宽高等
- YII2 视图中引入js代码块儿
- 在java代码中写js代码示例
- 让代码在SharePoint页面执行&&如何在aspx页面中写代码
- webstorm 在html页面中写javascript代码不高亮问题
- react写城市(省市区)联动
- 在js在页面中添加百度统计代码
- 国家城市二级联动jsp页面
- 云栖大会上,马云和王坚都说了啥?
- git submodule的使用
- android 的四种枚举Context.MODE_PRIVATE
- 音频、视频的格式
- Service
- yii2中在view页面写js代码/城市联动
- Android 自定义View canvas.drawBitmap使用举例
- House Robber II
- 在Python中使用QuantLib
- 条目的全选-反选_Demo
- TTreeView、TTreeNodes和TTreeNode
- Android的线程和线程池
- ORA-00093问题
- REDIS字符串-二进制安全的含义