This commit is contained in:
Bernie Chiu 2013-10-04 17:47:26 +08:00
parent 5e05f5d02b
commit 8684388ab9
2 changed files with 23 additions and 3 deletions

View File

@ -22,9 +22,15 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id) Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id)
end end
redirect_to panel_ask_front_end_thank_you_path # Render to create.js.erb
respond_to do |format|
format.js
end
else else
redirect_to panel_ask_front_end_sorry_path # Render to index.js.erb
respond_to do |format|
format.js { render :index }
end
end end
end end

View File

@ -14,7 +14,16 @@
} }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){
$("#spinner").bind("ajaxSend", function() {
$(this).show();
}).bind("ajaxStop", function() {
$(this).hide();
}).bind("ajaxError", function() {
$(this).hide();
window.location.href = "<%= panel_ask_front_end_thank_you_path %>";
});
});
</script> </script>
<div id="spinner" class="spinner" style="display:none;"> <div id="spinner" class="spinner" style="display:none;">
@ -100,5 +109,10 @@ $(document).ready(function(){
$('#new-ask-question .required').each(function() { $('#new-ask-question .required').each(function() {
$(this).text('*' + $(this).text()); $(this).text('*' + $(this).text());
}); });
$('#new-ask-question form') .submit(function() {
$.post($(this).attr('action'), $(this).serializeArray());
return false;
});
}); });
</script> </script>