记录:反馈系统
<div class="center_block hide" id="flash-notice"><p class="feedback_notice">感谢您的反馈😊</p></div>
<div class="feedback">
	<hr>
	<h5>对这一步骤感受如何❓</h5>
	<input type="radio" name="button" value="feedback" id="nice-feedback"><span style="font-size: 1.2em;">&nbsp;😄 &nbsp;很棒</span></input>&nbsp;
	<input type="radio" name="button" value="feedback" id="common-feedback"><span style="font-size: 1.2em;">&nbsp;😐 &nbsp;还可以</span></input>&nbsp;
  <input type="radio" name="button" id="bad-feedback" ><span style="font-size: 1.2em;">&nbsp;😭 &nbsp;很糟糕</span></input>&nbsp;
	<button type="button" name="button" id="content-feedback">直接吐槽</button>
</div>
	</div>
</div>

<!-- Modal -->  很糟糕的出现的modal
 <div class="modal fade in" id="getCodeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-dialog">
      <div class="modal-content">
       <div class="modal-header">
       <h4 class="modal-title center_block" id="myModalLabel">吐槽</h4>
       </div>
			 <div class="container center_block">
       <div class="col-md-6">
      <textarea name="name" rows="8" cols="60" class="form-control" placeholder="感谢您的意见" id="getCode"></textarea>
      <input type="submit" name="commit" value="吐槽" class="btn btn-primary btn-sm center_block" id="submit">
			       </div>
				 </div>
    </div>
   </div>
 </div>

<!-- only feedback content  -->直接吐槽的html

<div class="modal fade in" id="direct-wirte" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		 <div class="modal-content">
			<div class="modal-header">
			<h4 class="modal-title center_block">吐槽</h4>
			</div>
			<div class="container center_block">
			<div class="col-md-6">
		 <textarea name="name" rows="8" cols="60" class="form-control" placeholder="感谢您的意见" id="getDirect"></textarea>
		 <input type="radio" name="score" value="1" id="nice-feedback">1分</input>
		 <input type="radio" name="score" value="2" id="common-feedback">2分</input>
 		 <input type="radio" name="score" value="3" id="bad-feedback" >3分</input>
		 <br>
		 <input type="submit" name="commit" value="吐槽" class="btn btn-primary btn-sm center_block" id="direct-submit">
						</div>
				</div>
	 </div>
	</div>
</div>
$('#bad-feedback').click(function (event) {
	$("#getCodeModal").modal("toggle");             点击触发模态框
	$('#submit').attr('disabled', true);
	$('textarea#getCode').on('keyup',function() {
    var textarea_value = $("#getCode").val();    查看textarea有没有输入值,没有则button为disable,
    if(textarea_value != '') {                   有则为able
        $('#submit').attr('disabled' , false);
    }else{
        $('#submit').attr('disabled' , true);
    }
});
	$('#submit').click(function (event) {
		event.preventDefault();
		var message = $("textarea#getCode").val();   feedback的content为textarea的输入值
		$.ajax({
				url: '/feedbacks/ajax_create_feedback/', 这里是在后缀为js文件写法
				type: 'post',
				data: {
					  step : "resume_white_step_1",   上传feedback的参数
						score: 1,
						content: message
				},
				success: function (result) {
        $('#getCodeModal').modal('hide');     submit后 modal框消失
				$('.feedback').remove();               移走feedback模块
				$('#flash-notice').removeClass("hide"); 显示flash
				$('#flash-notice').fadeOut(3000);       淡出flash
				}
		});
		return false;
});
});

$('#content-feedback').click(function (event) {
	$("#direct-wirte").modal("toggle");
	$('#direct-submit').attr('disabled', true);
	$('textarea#getDirect').on('keyup',function() {
    var textarea_value = $("#getDirect").val();
    if(textarea_value != '') {
        $('#direct-submit').attr('disabled' , false);
    }else{
        $('#direct-submit').attr('disabled' , true);
    }
});
	$('#direct-submit').click(function (event) {
		event.preventDefault();
		var message = $("textarea#getDirect").val();
		var score = $("input[name='score']:checked").val();     上传分数的值
		$.ajax({
				url: '/feedbacks/ajax_create_feedback/',
				type: 'post',
				data: {
					  step : "resume_white_step_1",
						score: score,
						content: message
				},
				success: function (result) {
        $('#direct-wirte').modal('hide');
				$('.feedback').remove();
				$('#flash-notice').removeClass("hide");
				$('#flash-notice').fadeOut(3000);
				}
		});
		return false;
});
});