Quantcast
Viewing all articles
Browse latest Browse all 82115

POST data disappearing

I'm trying to POST back to my server to save edits. I use the method listed here:

http://www.datatables.net/release-datatables/examples/api/form.html

The problem is I'm only getting the first page of data, not the whole thing. I can see that sData has all the serialized data correctly (thank you FireBug), but, something is happening from that point to the point where I grab the $_POST data on the page reload.

I'm thinking it has something to do with the way I'm displaying my input fields, I'm hoping someone would have a suggestion on how I handle this.

I'm building my initial table by querying my database and building the table as follows:

<head>
$('#product_grid_form').submit( function() {
	var sData = oTable.$('input').serialize();
} );

var oTable = $('#product_grid').dataTable();
</head>
...
<form id="product_grid_form" method="post" action="thispage.php" name="product_grid">
<table id="product_grid" style="width:100%;">
<thead>
	<tr>
		<th>column header</th>
		...
		...
	</tr>
</thead>
<tbody>
<?php
$results = mysql_query("SELECT * FROM example")
while ($row = mysql_fetch_array( $results );) {
<tr>     
	<td><input type="text" value="<?=$row['name']?>" name="<?=$row['name'].$row['id']?>"></td>
	<td><input type="text" value="<?=$row['size']?>" name="<?=$row['size'].$row['id']?>"></td>
	...
	...
</tr>
}

?>
</tbody>
</table>
</form>

Is this because I have live input elements on the page they are overriding the sData passed by Datatables? Is there a way around this?

The only thing I found that may work is the jQuery post method

$('#product_grid_form').submit( function() {
	var sData = oTable.$('input').serialize();
	$.post("save_sdata.php", sData, function(){ alert('success!'); });
	return false;
} );

If I am understanding this correctly the page would not reload, this would just push the data to the "save_sdata.php" page.

Any suggestions would be appreciated.

Viewing all articles
Browse latest Browse all 82115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>