how do I read form data that a user inputed from an iframe?
without the iframe, i would do something like this:
The 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;
}
and 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>
and call the jQuery :
$('.get-data').live('click', function () {
postData = $(this).attr("id");
getRowData("form-table", $(this).attr("id");//here i have my form in an array...
});
now, if the html is in an iframe, how do i get the data?
You can access the
iframe‘s inner document and elements using this syntax:I hope that helped!