猫学乖
- 猫学乖 2015-09-09 已签到连续签到1天,获得了5个金钱
- 猫学乖 2015-09-01 已签到连续签到2天,获得了10个金钱
- 猫学乖 2015-08-31 已签到连续签到1天,获得了5个金钱
- 猫学乖 2015-08-18 已签到连续签到2天,获得了10个金钱
- 猫学乖 2015-08-17 已签到连续签到1天,获得了5个金钱
- 猫学乖 2015-08-07 已签到连续签到1天,获得了5个金钱
- 猫学乖 2015-08-04 已签到连续签到1天,获得了5个金钱
是浏览器主线程同步处理ajax请求的做法的提示,看起来是早期的js的方法,现在已废弃。改成异步应该就可以,百度一下有很多文章。推荐使用jquery的post方法请求modal需要的数据,然后在异步回调函数中更新modal数据再弹出modal。
前端jquery代码参考:
function releasePlaylist(id,name){ console.log('realeasePlaylist - id:'+id+', name:'+name); // 在模态框中填入当前playlist id $('#modalLabel-release').attr('playlistid', id); // ajax取出广告机组选择内容 if (!has_release_playlist_model_body){ $.post("/advertise/schedule/get-group-list", { }, function (data,status) { //console.log(data); var ret = eval('(' + data + ')'); if (ret['result'] == 'OK') { $('#release-body').html(ret['group-list']); has_release_playlist_model_body= true; } } ); } $('#playlist-name-tip').html(name); //弹出模态框 $('#release-playlist-modal').modal({keyboard: false}); }
后端代码供参考:
public function actionGetGroupList() { $boxGroups = BoxGroup::find()->where(['user_id'=>yii::$app->user->identity->username])->asArray()->all(); $renderResult= $this->renderPartial('_grouplist', [ 'boxGroups' => $boxGroups, 'boxesInGroup' => [], ]); return json_encode(['result'=>'OK','group-list'=>$renderResult]); }
其中
renderPartial
调用的view,可以是比较复杂的页面,可以带js等等。@性感的农民 我只是调用了另外一个创建表单的 _form.php
是浏览器主线程同步处理ajax请求的做法的提示,看起来是早期的js的方法,现在已废弃。改成异步应该就可以,百度一下有很多文章。推荐使用jquery的post方法请求modal需要的数据,然后在异步回调函数中更新modal数据再弹出modal。
前端jquery代码参考:
function releasePlaylist(id,name){ console.log('realeasePlaylist - id:'+id+', name:'+name); // 在模态框中填入当前playlist id $('#modalLabel-release').attr('playlistid', id); // ajax取出广告机组选择内容 if (!has_release_playlist_model_body){ $.post("/advertise/schedule/get-group-list", { }, function (data,status) { //console.log(data); var ret = eval('(' + data + ')'); if (ret['result'] == 'OK') { $('#release-body').html(ret['group-list']); has_release_playlist_model_body= true; } } ); } $('#playlist-name-tip').html(name); //弹出模态框 $('#release-playlist-modal').modal({keyboard: false}); }
后端代码供参考:
public function actionGetGroupList() { $boxGroups = BoxGroup::find()->where(['user_id'=>yii::$app->user->identity->username])->asArray()->all(); $renderResult= $this->renderPartial('_grouplist', [ 'boxGroups' => $boxGroups, 'boxesInGroup' => [], ]); return json_encode(['result'=>'OK','group-list'=>$renderResult]); }
其中
renderPartial
调用的view,可以是比较复杂的页面,可以带js等等。@性感的农民 但是我的验证js文件好像是通过ajax 获取的页面加载进来的, 这样也有用?
是浏览器主线程同步处理ajax请求的做法的提示,看起来是早期的js的方法,现在已废弃。改成异步应该就可以,百度一下有很多文章。推荐使用jquery的post方法请求modal需要的数据,然后在异步回调函数中更新modal数据再弹出modal。
前端jquery代码参考:
function releasePlaylist(id,name){ console.log('realeasePlaylist - id:'+id+', name:'+name); // 在模态框中填入当前playlist id $('#modalLabel-release').attr('playlistid', id); // ajax取出广告机组选择内容 if (!has_release_playlist_model_body){ $.post("/advertise/schedule/get-group-list", { }, function (data,status) { //console.log(data); var ret = eval('(' + data + ')'); if (ret['result'] == 'OK') { $('#release-body').html(ret['group-list']); has_release_playlist_model_body= true; } } ); } $('#playlist-name-tip').html(name); //弹出模态框 $('#release-playlist-modal').modal({keyboard: false}); }
后端代码供参考:
public function actionGetGroupList() { $boxGroups = BoxGroup::find()->where(['user_id'=>yii::$app->user->identity->username])->asArray()->all(); $renderResult= $this->renderPartial('_grouplist', [ 'boxGroups' => $boxGroups, 'boxesInGroup' => [], ]); return json_encode(['result'=>'OK','group-list'=>$renderResult]); }
其中
renderPartial
调用的view,可以是比较复杂的页面,可以带js等等。renderPartial得到的带js的页面他里面加载的js会起作用吗?为何我得到的表单,里面的验证都不能正常工作了?