{"size": 1076, "ext": "js", "max_stars_repo_path": "web/js/role/set.js", "max_stars_repo_name": "yiiabc/yihome", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "web/js/role/set.js", "max_issues_repo_name": "yiiabc/yihome", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "web/js/role/set.js", "max_forks_repo_name": "yiiabc/yihome", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.619047619, "max_line_length": 68, "alphanum_fraction": 0.3866171004}
/**
 * Created by afellow on 2017/12/21.
 */
;//是因为多个js文件压缩合并的时候，可能和上一个js文件代码相冲
var role_set_ops = {
    init: function () {
        this.eventBind();
    },
    eventBind: function () {
        $(".role_set_wrap .save").click(function(){
            var name = $('.role_set_wrap input[name="name"]').val();
            var id = $('.role_set_wrap input[name="id"]').val();
            if ( name.length < 1 )
            {
                alert("请输入合法的角色名称~~");
                return false;
            }
            $.ajax({
                url:'/role/set',
                type:'post',
                data:{
                    name:name,
                    id:id
                },
                dataType:'json',
                success:function( data ){
                    alert( data.msg );
                    if( data.code == 200 )
                    {
                        window.location.href = '/role/index';
                    }
                }
            })
        })
    }
};

//页面加载完成之后
$(document).ready(function () {
    role_set_ops.init();
});
