I cannot get this update script to work in IE. Works great in any other browser. IE tells me that the update is complete. However, it is not. I no longer have hair to pull out .... BTW I tried $.ajax and $.get too .. no luck. I think this may have something to do with the live click handler. I donβt know ... I tried everything ... (I put headers for the cache, adding a random number to the end of the url line) .. nothing Frank works ... IE exploded.
This is the function $('.save').live('click') that I use:
$(".save").live("click", function(){ $.post("update.php", { cache : false, saveID : saveIt.value, saveMo : saveMonth, saveYr : saveYear, saveCtg : saveCt, saveThg : saveTh }, function(data){ if(data.success) { $(textareaThoughts).hide(); $(saveIt).parents(".dirRowOne").find(".cancel").hide(); $(saveIt).parents(".dirRowOne").find(".edit, .del").show(); $(saveIt).hide(); $("#dirConsole").html(data.message); } else if(data.error) { } }, "json"); return false; });
Here update.php
<?php if($_POST) { $data['id'] = $db->escape_value($_POST['saveID']); $data['months'] = trim($db->escape_value($_POST['saveMo'])); $data['years'] = trim($db->escape_value($_POST['saveYr'])); $data['cottages'] = trim($db->escape_value($_POST['saveCtg'])); $data['thoughts'] = trim(htmlentities($db->escape_value($_POST['saveThg']))); $id = $data['id']; $m = $data['months']; $y = $data['years']; $c = $data['cottages']; $t = $data['thoughts']; $query = "UPDATE //tablename SET month = '{$m}', year = '{$y}', cottage = '{$c}', thoughts = '{$t}' WHERE dirID = '{$id}'"; $result = $db->query($query); if($result) { $data['success'] = true; $data['message'] = "Update Successful!"; } else { $data['error'] = true; } echo json_encode($data); } ?>
This is the JSON response:
{"id":"360","months":"June","years":"1990","cottages":"Cedar","thoughts":"Hello","success":true,"message":"Update Successful!"}
Scott source share