我正在与Devise一起使用Rails 4,我正试图将PayPal集成到用户注册中。
我的注册表单声明如下:
编辑:按要求发布完整表格
<div class="heading">
<h2>SIGN UP</h2>
</div>
<%= form_for(resource, remote: true, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div class="form-field-area">
<p class="form-label"><%= f.label :full_name, "Full Name (required)" %></p>
<p class="form-label"><%= f.text_field :full_name %></p>
</div>
<div class="form-field-area">
<p class="form-label"><%= f.label :business_name, "Business Name (required)" %></p>
<p class="form-label"><%= f.text_field :business_name %></p>
</div>
<div class="form-field-area">
<p class="form-label"><%= f.label :street_line_one %></p>
<p class="form-label"><%= f.text_field :street_line_one %></p>
</div>
<div class="form-field-area">
<p class="form-label"><%= f.label :street_line_two %></p>
<p class="form-label"><%= f.text_field :street_line_two %></p>
</div>
<div class="form-field-area">
<p class="form-label"><%= f.label :town %></p>
<p class="form-label"><%= f.text_field :town, :value => "Maynooth", readonly: true %></p>
</div>
<div class="form-field-area">
<p class="form-label"><%= f.label :county %></p>
<p class="form-label"><%= f.text_field :county, :value => "Kildare", readonly: true %></p>
</div>
<div class="form-field-area">
<p class="form-label"><%= f.label :email, "Email (required)" %></p>
<p class="form-label"><%= f.email_field :email, autofocus: true %></p>
</div>
<div class="form-field-area">
<p class="form-label"><%= f.label :password, "Password (required)" %></p>
<p class="form-label"><%= f.password_field :password, autocomplete: "off" %></p>
</div>
<div class="form-field-area">
<p class="form-label"><%= f.label :password_confirmation, "Password Confirmation (required)" %></p>
<p class="form-label"><%= f.password_field :password_confirmation, autocomplete: "off" %></p>
</div>
<%#= f.submit "Sign up", :class=>"button button-green button-login" %>
<% end %>
<div class="paypal-area">
<form action="https://www.paypal.com/cgi-bin/webscr" id="paypal_form" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="JXB4TF9GG2UW6">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!", onClick="submitForms()">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
我直接从网站上获得了贝宝形式和按钮。我非常,非常非常初学javascript,所以继续提出几个问题,主要是this one,我在application.js中有以下内容
submitSignUpForm = function(){
document.getElementById("new_user").submit();
}
$('#paypal_form').submit(function(){
submitSignUpForm();
$(this).ajaxSubmit({async: true});
})
点击paypal提交按钮会将我重定向到paypal网站,但我的第一个表单未提交。关于如何解决这个问题的任何想法将非常感激。