ユーザーが iframe から入力したフォーム データを読み取るにはどうすればよいですか?
iframe がなければ、次のようにします。
jQuery:
function getRowData(id, parent){
var data = [];
$(parent+' table tr').each(function(){
var row = {};
$(this).find('select, input, textarea').each(function(){
if(($(this).attr('id') == id) && (typeof $(this).attr('name') !== 'undefined' && $(this).attr('name') !== false)){
row['id'] = id;
row[$(this).attr('name')] = $(this).val();
}
});
data.push(row);
});
return data;
}
および HTML:
<table id="form-table">
<td><input type="checkbox" name="n_available" checked="checked"></td>
<td><input type="checkbox" name="n_oem" checked="checked"></td>
</table>
jQuery を呼び出します。
$('.get-data').live('click', function () {
postData = $(this).attr("id");
getRowData("form-table", $(this).attr("id");//here i have my form in an array...
});
HTMLがiframeにある場合、データを取得するにはどうすればよいですか?