我不能让这个更新脚本在IE中工作.在其他浏览器中都可以正常工作IE告诉我更新已执行.但事实并非如此.我没有更多的头发可以拔出来了.顺便说一下,我已经尝试过$.ajax和$.get ..但是没有运气.我认为它可能与实时点击处理程序有关.不知道……我已经尝试了所有的东西..(把标题放入无缓存,将随机数附加到我的url字符串的末尾)..没有fricken工作……爆炸IE.
这是我使用的$(‘.save’).live(‘click’)函数:
$(".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; });
这是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); } ?>
这是JSON响应:
{"id":"360","months":"June","years":"1990","cottages":"Cedar","thoughts":"Hello","success":true,"message":"Update Successful!"}