tablednd post issue help please

Posted by netrise on Stack Overflow See other posts from Stack Overflow or by netrise
Published on 2012-03-22T11:14:41Z Indexed on 2012/03/22 11:29 UTC
Read the original article Hit count: 239

Filed under:
|
|
|

Hi plz i got a terrible headache my script is very simple Why i can’t get $_POST['table-2'] after submiting update button, i want to get ID numbers sorted

#

index.php

    <head>
<script src="jquery.js" type="text/javascript"></script><br />
<script src="jquery.tablednd.js" type="text/javascript"></script><br />
<script src="jqueryTableDnDArticle.js" type="text/javascript"></script><br />
</head>
<body>

<form method='POST' action=index.php>
<table id="table-2" cellspacing="0" cellpadding="2">
<tr id="a"><td>1</td><td>One</td><td><input type="text" name="one" value="one"/></td></tr>
<tr id="b"><td>2</td><td>Two</td><td><input type="text" name="two" value="two"/></td></tr>
<tr id="c"><td>3</td><td>Three</td><td><input type="text" name="three" value="three"/></td></tr>
<tr id="d"><td>4</td><td>Four</td><td><input type="text" name="four" value="four"/></td></tr>
<tr id="e"><td>5</td><td>Five</td><td><input type="text" name="five" value="five"/></td></tr>
</table>    
<input type="submit" name="update" value="Update">
</form>
<?php
$result[] = $_POST['table-2'];
foreach($result as $value) {
    echo "$value<br/>";
}
?>
</body>
#

jqueryTableDnDArticle.js ………….

     $(“#table-2?).tableDnD({
onDragClass: “myDragClass”,
onDrop: function(table, row) {
var rows = table.tBodies[0].rows;
var debugStr = “Row dropped was “+row.id+”. New order: “;
for (var i=0; i<rows.length; i++) {
debugStr += rows[i].id+" ";
}
//$("#debugArea").html(debugStr);
$.ajax({
type: "POST",
url: "index.php",
data: $.tableDnD.serialize(),
success: function(html){
alert("Success");
}
});

},
onDragStart: function(table, row) {
$("#debugArea").html("Started dragging row "+row.id);
}
});

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery