jQuery $ .post更新无法在IE中运行

Sco*_*ott 4 ajax jquery json internet-explorer-7

我不能让这个更新脚本在IE中工作.适用于所有其他浏览器.IE告诉我更新已执行.但事实并非如此.我没有更多的头发可以拔出来了.BTW我已经试过$.ajax$.gettoo..still没有运气.我认为它可能与live点击处理程序有关.不知道......我已经尝试了所有的东西..(把标题放入无缓存,将随机数附加到我的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;
});
Run Code Online (Sandbox Code Playgroud)

这是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);

 }


?>
Run Code Online (Sandbox Code Playgroud)

这是JSON响应:

{"id":"360","months":"June","years":"1990","cottages":"Cedar","thoughts":"Hello","success":true,"message":"Update Successful!"}
Run Code Online (Sandbox Code Playgroud)

小智 10

我同意上面的答案.当没有使用缓存破坏字符串时,我已经看到IE浏览器带有AJAX请求,包括GET和POST.只需将随机缓存清除字符串附加到您的网址,如下所示:

    $.post("update.php?ts="+new Date().getMilliseconds(), { cache : false, saveID : saveIt.value, saveMo : saveMonth, saveYr : saveYear, saveCtg : saveCt, saveThg : saveTh },
      function(data){
...
Run Code Online (Sandbox Code Playgroud)

它应该开始在IE中工作.