Post form without ajax
This commit is contained in:
parent
48969b70b5
commit
63fab74a25
|
@ -22,15 +22,9 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
|
|||
Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id)
|
||||
end
|
||||
|
||||
# Render to create.js.erb
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
redirect_to panel_ask_front_end_thank_you_path
|
||||
else
|
||||
# Render to index.js.erb
|
||||
respond_to do |format|
|
||||
format.js { render :index }
|
||||
end
|
||||
redirect_to panel_ask_front_end_sorry_path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -14,15 +14,7 @@
|
|||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$("#spinner").bind("ajaxSend", function() {
|
||||
$(this).show();
|
||||
}).bind("ajaxStop", function() {
|
||||
$(this).hide();
|
||||
}).bind("ajaxError", function() {
|
||||
$(this).hide();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div id="spinner" class="spinner" style="display:none;">
|
||||
|
@ -30,7 +22,7 @@ $(document).ready(function(){
|
|||
</div>
|
||||
<div id="new-ask-question" class="ask-question">
|
||||
<div id="acknowledgement"></div>
|
||||
<%= form_for @ask_question, url: panel_ask_front_end_ask_questions_path(standalone: true), html: {class: 'form-horizontal'} do |f| %>
|
||||
<%= form_for @ask_question, url: panel_ask_front_end_ask_questions_path(standalone: true), html: {class: 'form-horizontal'}, method: :post do |f| %>
|
||||
<div class="control-group">
|
||||
<%= f.label :ask_category_id, class: 'control-label required' %>
|
||||
<div class="controls">
|
||||
|
@ -108,10 +100,5 @@ $(document).ready(function(){
|
|||
$('#new-ask-question .required').each(function() {
|
||||
$(this).text('*' + $(this).text());
|
||||
});
|
||||
|
||||
$('#new-ask-question form') .submit(function() {
|
||||
$.post($(this).attr('action'), $(this).serializeArray());
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -21,7 +21,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
|
||||
namespace :front_end do
|
||||
get "ask_questions/thank_you" => "ask_questions#thank_you", :as => 'thank_you'
|
||||
match "ask_questions/thank_you" => "ask_questions#thank_you", :as => 'thank_you'
|
||||
match "ask_questions/sorry" => "ask_questions#sorry", :as => 'sorry'
|
||||
resources :ask_questions
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue