javascript在firefox中工作但在ie中不起作用

时间:2015-04-30 02:05:33

标签: javascript jquery internet-explorer firefox

我无法让这段代码在ie中工作。它不会抛出任何错误或警告。我被卡住了。帮助任何人? (第28行是不工作的部分)。如果第二个ajax部分的结果失败,警报框将弹出正常,但如果成功,则不会将用户电子邮件插入名为“donorEmail”的输入框。

  function getEmail(ticketID) {  

  // find email based on first and last name.

  var donor = $('#q').val();

  $.ajax({
    type: "POST",
    url: "action.php",
    data: {field: 'donorID', donor:donor },
    async: false,
    success: function (result) {
                if(result != 0) {
                    document.getElementById("donorID").value = Number(result);
                } else {
                    document.getElementById("donorID").value = '0';
                }
            },
    error: function (result) {
                pass = "error"
                alert("There was an error with the database");
            }
  });       

  $.ajax({
    type: "POST",
    url: "action.php",
    data: {field: 'donorEmail', donor:donor },
    async: false,
    success: function (result) {
                if(result != 0) {
                    document.getElementById("donorEmail").value = result;
                } else {
                    alert("No email on file for this donor");
                    document.getElementById("donorEmail").value = '';
                }
            },
    error: function (result) {
                pass = "error"
                alert("There was an error with the database");
            }
  });
}

0 个答案:

没有答案