【问题标题】:ajax code not responding on ie8 and ie9ajax 代码在 ie8 和 ie9 上没有响应
【发布时间】:2014-05-22 11:45:36
【问题描述】:
 function search_val()  {

    $("#company_code_nr1").click();

    $("#poc").click();
    $("#company_code_nr").click();
    $("#subcompany_code_nr").click();
    $("#cs_code_nr").click();
    $("#invoice_id_nr").click();
    $("#user_code_tx").click();
    $("#owner_code_nr").click();
if (window.XMLHttpRequest)
  {
// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();

  }
else
  {
// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }

   var str=$("#company_code_nr").val();
   var str2=$("#subcompany_code_nr").val();
   var str3=$("#product_code_nr").val();
   var str4=$("#invoice_code_nr").val();

  var url="hotkeydetail.php?f3="+str+"&c4="+str2+"&c6="+str3+"&c7="+str4;

xmlhttp.open("GET",url,true);
xmlhttp.send();


             }

嗨,我正在使用代码在另一个页面上获取内容,一切正常 Mozilla 和其他浏览器也可以在 IE 10 上运行。但在 ie8 和 ie9 上没有响应。请帮我。谢谢

【问题讨论】:

  • 为什么你会决定使用 jQuery,然后不将它用于 ajax,这是它最擅长的事情之一?
  • 打开浏览器控制台,看看正在打印什么
  • 在 ie8 上没有任何工作。
  • 如果你们有任何解决方案请帮帮我...

标签: javascript php mysql ajax internet-explorer


【解决方案1】:

像这样使用 jQuery Ajax:

function search_val()  {

    $("#company_code_nr1").click();

    $("#poc").click();
    $("#company_code_nr").click();
    $("#subcompany_code_nr").click();
    $("#cs_code_nr").click();
    $("#invoice_id_nr").click();
    $("#user_code_tx").click();
    $("#owner_code_nr").click();

    var str=$("#company_code_nr").val();
    var str2=$("#subcompany_code_nr").val();
    var str3=$("#product_code_nr").val();
    var str4=$("#invoice_code_nr").val();

    $.ajax({
      type: 'GET',
      url: 'hotkeydetail.php',
      data:{'f3':str,'c4':str2,'c6':str3,'c7':str4}, 
      success: function(result){
          $('#txtHint').html(result);
      }
   });



}

【讨论】:

  • 查看我的代码,其中 txtHint 是我获取记录的 id .. 在您的代码中,我不知道如何发送这些值数据:{'f3':str,'c4':str2,' c6':str3,'c7':str4},还有如何获取
  • 实际上的问题是在 ie8 上运行时响应仅出现在
    标记中,我需要获取另一个 html 标记。
  • 你能再解释一下吗?
  • 我怎么能。不介意,但我已经发布了必要的代码。请告诉我如何解释更多。
  • 你说actually problem is that response is come in only <div> tag while running on ie8 i need to get another html tag。您说的是哪个
    或“另一个 html”?
猜你喜欢
相关资源
最近更新 更多
热门标签