iframeで表示することにより、10万から20万のWebサイトをフィルタリングしてWebサイトの所有者の名前とメールを収集するプロジェクトがあります。私が本当に必要としているのは、レビューした Web サイトで名前をクリック/選択すると、名前入力フォームが自動的に入力され、電子メールも同様です。
誰かが解決策を知っていますか?任意の応答をいただければ幸いです。
*私のコードが必要な場合は、教えてください。ここに置きます。<iframe>
ただし、これはと を含む html ページにすぎませ<form>
ん。
コードは次のとおりです。
<div class="container container-harvester">
<div class="harvester-form">
<%= form_for(:harvesters, :html => {:class => "form-horizontal"}) do |f| %>
Name: <%= f.text_field :name %>
Email: <%= f.text_field :email %>
<%= f.hidden_field :website, :value => "", :class => "website-harvester" %>
<%= f.hidden_field :skipped, :value => "true" %>
<%= f.submit "Submit", :class => "btn btn-primary submit-harvester", "data-disable-with" => "Saving..." %>
<a href="#" class="delete-website btn btn-danger" data-id="">Delete</a>
<% end %>
</div>
<div class="harvester-iframe">
<iframe name="harvester-iframe" data-id="<%= @websites.first.id %>" src="<%= @websites.first.url %>" frameborder="0">
</iframe>
</div>
<div class="harvester-link">
<ul>
<% @websites.each do |w| %>
<% unless @registered.collect(&:website).include?(w.url) %>
<li><a class="" href="<%= w.url %>" target="harvester-iframe" data-id="<%= w.id %>"><%= w.url %></a></li>
<% end %>
<% end %>
</ul>
</div>
</div>
<% content_for :unobtrusive_js do %>
<script type="text/javascript">
$(document).ready( function() {
$('.harvester-link a').on('click', function (e) {
var url = $(this).attr('href')
, id = $(this).attr('data-id')
, $el = $(e.currentTarget);
$('.harvester-iframe iframe').attr('src', url);
$('.harvester-iframe iframe').attr('data-id', id);
$('.website-harvester').attr('value', url);
$('.delete-website').attr('data-id', id);
$('.submit-harvester').attr('data-id', id);
$('.harvester-link a').removeClass('active');
$el.addClass('active');
});
$('.harvester-iframe iframe').on('load', function (e) {
var url = $(this).attr('src')
, id = $(this).attr('data-id')
, $el = $(e.currentTarget);
$('.delete-website').attr('value', url);
$('.delete-website').attr('data-id', id);
$('.website-harvester').attr('value', url);
$('.submit-harvester').attr('data-id', id);
});
$('.delete-website').on('click', function (e) {
e.preventDefault();
var id = $(this).attr('data-id');
API.delete(Routes.harvester_website_path(id)).done(function (response) {
window.location.reload();
});
})
$('.submit-harvester').on('click', function (e) {
var id = $(this).attr('data-id');
API.delete(Routes.harvester_website_path(id)).done(function (response) {
window.location.reload();
});
})
});
</script>
<% end %>