Tuesday, 15 July 2014

php - Uncaught syntax error in dynamic jquery -



php - Uncaught syntax error in dynamic jquery -

i've been working on piece of dynamic javascript code:

$(document).ready(function() { <?php $sql = "select * pm_schedule"; $result = $pdo->query($sql); foreach ($result $row) { echo "$('#updatebtn".$row['id']."').click(function() { $('#result".$row['id']."').show('slow').delay(4000).hide('slow') $.post('process.php', $('#updateform".$row['id']."').serialize(), });"; } ?> });

it expands next when run on server:

$(document).ready(function () { $('#updatebtn1').click(function () { $('#result1').show('slow').delay(4000).hide('slow') $.post('process.php', $('#updateform1').serialize(), }); $('#updatebtn2').click(function () { $('#result2').show('slow').delay(4000).hide('slow') $.post('process.php', $('#updateform2').serialize(), }); $('#updatebtn3').click(function () { $('#result3').show('slow').delay(4000).hide('slow') $.post('process.php', $('#updateform3').serialize(), }); $('#updatebtn4').click(function () { $('#result4').show('slow').delay(4000).hide('slow') $.post('process.php', $('#updateform4').serialize(), }); $('#updatebtn5').click(function () { $('#result5').show('slow').delay(4000).hide('slow') $.post('process.php', $('#updateform5').serialize(), }); });

google chrome keeps returning uncaught syntax error code above - thought why? please note have create edits first code block , not second.

replace comma , @ end here $('#updateform".$row['id']."').serialize(),<-- )

php jquery mysql pdo

No comments:

Post a Comment