“Update” function not working in IE 7 or 8 but works in Firefox

orbits

New Member
Internet Explorer seems to be ignoring this .live function call during updating records but it works fine in FF.if \[quote\] $("form#updateform").live("submit", function(){\[/quote\]\[code\]line is changed to\[/code\]\[quote\] $("form#updateform").live("click", function(){\[/quote\]update function is working perfectly in IE but in Firefox if i click on any object it takes data before i do something .... please suggest me, Help someone please...index.php\[code\]<html><head><title>Testing AJAX</title><script type="text/javascript" src="http://stackoverflow.com/questions/3792641/jquery.js"></script></head><body><div class="container"> <form id="submit" method="post"> <fieldset><legend>Enter Information</legend> <label for="actnam" >Activity : </label><input id="actnam" name="actnam" class="text" size="20" type="text"> <label for="actres" >Responsibility : </label><input id="actres" name="actres" class="text" size="20" type="text"> <label for="actdat" >DAte : </label><input id="actdat" name="actdat" class="text" size="10" type="text"> <label for="actsta" >status : </label><input id="actsta" name="actsta" class="text" size="20" type="text"> <label for="actcom" >comments : </label><input id="actcom" name="actcom" class="text" size="20" type="text"> <input type="submit" value="http://stackoverflow.com/questions/3792641/Add"> </fieldset> </form> <div class="name_list"></div> <div class="update_form"></div> </div><script type="text/javascript">$(document).ready(function(){ function loadList(){ // load list start $.ajax({ url: "load-list.php", cache: false, success : function(html){ $(".name_list").html(html); } }); }loadList(); $("form#submit").submit(function() { // we want to store the values from the form input box, then send via ajax below var x=window.confirm("Are you sure you want to delete this item?") var actnam = $('#actnam').attr('value'); var actres = $('#actres').attr('value'); var actdat = $('#actdat').attr('value'); var actsta = $('#actsta').attr('value'); var actcom = $('#actcom').attr('value'); if (x==true){ $.ajax({ type: "POST", url: "save.php", data: "actnam="+ actnam +"& actres="+ actres +"& actdat="+ actdat + "& actsta="+ actsta +"& actcom="+ actcom, success: function(){ loadList(); } }); } return false; }); $(".delete_button").live("click", function(){ //this deletes the row clicked on with an alert and then reloads the list var idvaluein = $(this).attr("id"); var x=window.confirm("Are you sure you want to delete this item?"); if (x==true){ $.ajax({ type: "POST", url: "delete.php", data: "id="+ idvaluein, success: function(){ loadList(); } }); } return false; }); $(".update_button").live("click", function(){ //this loads the update form var idvaluein = $(this).attr("id"); var x=window.confirm("Are you sure you want to update this item?"); if (x==true){ alert(idvaluein); $.ajax({ url: "update-form.php", data: "id="+ idvaluein, cache: false, success: function(html){ $(".update_form").html(html); } }); } return false; }); $("form#updateform").live("submit", function(){ var actnam = $('#actnam_update').attr('value'); var actres = $('#actres_update').attr('value'); var actdat = $('#actdat_update').attr('value'); var actsta = $('#actsta_update').attr('value'); var actcom = $('#actcom_update').attr('value'); var idvaluein = $('#id_update').attr('value'); $.ajax({ type: "POST", url: "update.php", data: "actnam="+ actnam +"& actres="+ actres +"& actdat="+ actdat +"& actsta="+ actsta +"& actcom="+ actcom+"& id="+ idvaluein, success: function(){ $(".update_form").empty(); loadList(); } }); return false; });});</script> </body></html><?php $hostname="localhost";$username="root";$password="";$dbname="stact";$conn = mysql_connect($hostname,$username,$password) or die ('Not Connecting to the database');@mysql_select_db($dbname) or die ('Not accessing table');$idvalue=http://stackoverflow.com/questions/3792641/substr($_GET['id'],7);$sql="SELECT * FROM act_tab WHERE slno='$idvalue'";$query=mysql_query($sql);$result = mysql_fetch_assoc($query);?><form id="updateform" method="post"> <fieldset> <legend>Update Activity</legend> <label for="actnam_update">Activity :</label><input id="actnam_update" name="actnam_update" class="text" size="20" type="text" value="http://stackoverflow.com/questions/3792641/<?php echo $result['act_nam']; ?>"> <label for="actres_update">Responsibility :</label><input id="actres_update" name="actres_update" class="text" size="20" type="text" value="http://stackoverflow.com/questions/3792641/<?php echo $result['act_res']; ?>"> <label for="actdat_update">Date :</label><input id="actdat_update" name="actdat_update" class="text" size="10" type="text" value="http://stackoverflow.com/questions/3792641/<?php echo $result['act_dat']; ?>"> <label for="actsta_update">status :</label><input id="actsta_update" name="actsta_update" class="text" size="20" type="text" value="http://stackoverflow.com/questions/3792641/<?php echo $result['act_sta']; ?>"> <label for="actcom_update">Comments :</label><input id="actcom_update" name="actcom_update" class="text" size="20" type="text" value="http://stackoverflow.com/questions/3792641/<?php echo $result['cct_com']; ?>"> <input id="id_update" size="20" type="hidden" value="http://stackoverflow.com/questions/3792641/<?php echo $result['slno']; ?>"> <input type="submit" value="http://stackoverflow.com/questions/3792641/Update"> </fieldset></form>\[/code\]Update.php\[code\]<?php $hostname="localhost"; $username="root"; $password=""; $dbname="stact"; $conn = mysql_connect($hostname,$username,$password) or die ('Not Connecting to the database'); @mysql_select_db($dbname) or die ('Not accessing table'); // CLIENT INFORMATION $actnam = htmlspecialchars(trim($_POST['actnam'])); $actres = htmlspecialchars(trim($_POST['actres'])); $actdat = htmlspecialchars(trim($_POST['actdat'])); $actsta = htmlspecialchars(trim($_POST['actsta'])); $actcom = htmlspecialchars(trim($_POST['actcom'])); $idvaluein = htmlspecialchars(trim($_POST['id'])); $rem = "UPDATE act_tab SET act_nam='$actnam',act_res='$actres',act_dat='$actdat',act_sta='$actsta',cct_com='$actcom' WHERE slno='$idvaluein'"; mysql_query($rem) or die(mysql_error());mysql_close($conn);?>\[/code\]load-list.php\[code\]<?php $hostname="localhost";$username="root";$password="";$dbname="stact";$conn = mysql_connect($hostname,$username,$password) or die ('Not Connecting to the database');@mysql_select_db($dbname) or die ('Not accessing table');$sql='SELECT * FROM act_tab ORDER BY act_dat';$query=mysql_query($sql); ?><table width="100%" border="1" cellspacing="1" bordercolor="#00CC33" id="thetable"><?php while($result = mysql_fetch_assoc($query)){?><div class="element" id="element-<?php echo $result['slno']; ?>"><tr> <td><?php echo $result['act_nam']; ?></td> <td> <?php echo $result['act_res']; ?></td> <td> <?php echo $result['act_dat']; ?></td> <td> <?php echo $result['act_sta']; ?></td> <td> <?php echo $result['cct_com']; ?></td> <td> <a href="javascript:void(0);" id="<?php echo $result['slno']; ?>" class="delete_button">Delete</a></td> <td> <a href="javascript:void(0);" id="update-<?php echo $result['slno']; ?>" class="update_button">Update</a></td> </tr><?php } ?></div></table>\[/code\]
 
Back
Top