@ -4,7 +4,7 @@
</div>
<div class="task_popup_con mt15 ml30">
<div class="mr15">
<%= form_tag({:controller => 'courses', :action => 'join_course_multi_role'}, :remote => true, :method => :post, :id => 'new-watcher-form') do % >
<form id="new-watcher-form" >
<ul>
<li class="clearfix mb10">
<label class="panel-form-label fl">课堂邀请码:</label>
@ -32,7 +32,7 @@
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_join_course();">确定</a>
</li>
</ul>
<% end % >
</form >
</div>
</div>
</div>
@ -45,10 +45,30 @@
$("#none_invite_code_notice").hide();
if ($("input[name='role[]']:checked").length >= 1){
$("#none_checked_notice").hide();
$('#new-watcher-form').submit();
$.ajax({
url: "/api/courses/apply_to_join_course.json",
type: "post",
dataType: 'json',
data: {
student: $("#join_course_role_10").is(":checked") ? 1 : "",
professor: $("#join_course_role_9").is(":checked") ? 1 : "",
assistant_professor: $("#join_course_role_7").is(":checked") ? 1 : "",
invite_code: $("input[name='invite_code']").val(),
},
success: function(data){
if(data.status == -1){
$("#none_checked_notice").html(data.message).show();
} else if(data.status == 0 && data.message == "成功"){
window.location = "/courses/"+data.course_id+"/students";
} else{
hideModal();
notice_box(data.message);
}
}
});
return;
}else{
$("#none_checked_notice").show();
$("#none_checked_notice").html("请至少选择一个身份"). show();
}
}
}