<div class="content_wrapper">

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>代码调试</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-horizontal" role="form" method="post" action="debug/actionevalphp" data-validate="validate" data-callBack="showdata" data-useDefaultCallBack="on">
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">请求环境</label>
                                            <div class="col-sm-4">
                                                <div class="radio">
                                                    <label>
                                                        <input type="radio" name="reqenv" value="local" checked>内网
                                                    </label>
                                                </div>
                                                <div class="radio">
                                                    <label>
                                                        <input type="radio" name="reqenv" value="officia">正式
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">详细参数</label>
                                            <div class="col-sm-5">
                                                <textarea rows="8" class="form-control" name='detailed'></textarea>
                                            </div>
                                        </div>
                                        <hr/>
                                        <div class="form-group">
                                            <div class=" col-sm-12">
                                                <button type="button" class="btn btn-primary J_ajaxSubmitBtn">提交</button>
                                            </div>
                                        </div>
                                    </form>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">返回数据</label>
                                        <div class="col-sm-8">
                                            <textarea rows="12" class="form-control" name='returndata'></textarea>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>

</div>


<script>
    function showdata(returnData, $from) {
        var rd = $('textarea[name="returndata"]');
        rd.val('');
        rd.val(returnData.retdata);
    }


    function validate($from) {
        var detailed = $from.find('textarea[name="detailed"]');
        if ($.trim(detailed.val()) == '') {
            return '代码内容不能为空';
        }

        return true;
    }
</script>