猫学乖

猫学乖

这家伙有点懒,还没写个性签名!

  • 财富值223
  • 威望值20
  • 总积分513

个人信息

  • 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会起作用吗?为何我得到的表单,里面的验证都不能正常工作了?

主管 等级规则
513/1000
资料完整度
0/100
用户活跃度
0/100

Ta的关注

0

Ta的粉丝

3

Ta的访客

7