给定以下形式:
<form class="email-form" action="" method="PUT" data-remote="true" data-method="put">
<ul>
<li>
<label for="sEmail1">
<input type="text" id="sEmail1" name="emails[]" value="d@google.com"
placeholder="">
</label>
</li>
<li>
<label for="sEmail2">
<input type="text" id="sEmail2" name="emails[]" value="d2@google.com"
placeholder="">
</label>
</li>
<li>
<label for="sEmail3">
<input type="text" id="sEmail3" name="emails[]" value="d3@google.com"
placeholder="">
</label>
</li>
</ul>
<button type="submit">Continue</button>
</form>
如何使用查询来获取完整的电子邮件列表并将其发布到 rails 如下:
Parameters: {"emails"=>{"list"=>["d@google.com", "d2@google.com","d2@google.com"]}}
我有以下内容:
$.ajax({
type: 'POST',
url: '/send_invites',
data: {
emails : {
list : $('.email-form').serialize()
},
_method : 'PUT'
},
success : function() {
}
});