Ajax请求不在IE中发送。 11

时间:2015-12-31 00:50:34

标签: javascript jquery ajax twitter-bootstrap internet-explorer

我见过很多关于ajax和IE问题的问题,但我还没有找到像这样的问题..

环境是Bootstrap / jQuery / Ajax / parsley / IE-11

我有一个在Firefox和Chrome中运行的ajax脚本。在IE 11中,脚本不会发送...它会直接跳转到失败部分。它应该用内容弹出一个bootstrap模态。模态弹出,但它是空的。

ajax请求的url与它所在页面的URL相同... 它是一个http请求,而不是一个https请求..它是一个ping到192.168地址的内部Web服务器。

在不使用bootstrap的系统的早期版本(在相同的url之间)上的Ajax请求没有问题。

我已关闭所有console.log()。没有帮助。 我关闭了服务器,它没有什么区别......请求没有到达那里......

我尝试降低所有安全设置,而不进入自定义详细信息对话框..没有效果..

当我重新启动控制台日志失败时 我得到:请求失败:[对象对象](对象不可点击)

ie中的某些内容阻止了请求..

<script>
var AjaxSubmit
$("#rbbutton, #ubbutton").click(function() {
   AjaxSubmit =  $(this).attr("value");
   return true;
});

$(function () {
  var serverScript = '#serverurl' ; // Server side script we will be calling
    $("#rb").submit(function(e) {
      var str      =  $('#rb').serialize();
      str          = str + '&ajaxfunction=IamBidding' + '&AjaxSubmit='+encodeURIComponent(AjaxSubmit);

    if (typeof console == "object") {
    }
     var request   = $.ajax({
       type     : "POST",
       url      : serverScript,
       data     : str,
       cache    : false,
       encode   : true
       });
  request.done(function(data) {
    $("#modalbidconfirm").html(data);
    $('#bidconfirmmodal').modal('show');
   });
  request.fail(function( data) {
    if (typeof console == "object") {
      console.log( "Request failed: " + data  );
    }
    $("#modalbidconfirm").html(data);
    $('#bidconfirmmodal').modal('show');
  });
  e.preventDefault(); // avoid to execute the actual submit of the form.
 });
});
</script>

1 个答案:

答案 0 :(得分:1)

问题不在javascript中。问题出在html中,我没有在问题中加入。

Firefox和chrome没有在div中定义serverurl id的问题。

除非在输入中定义了serverurl,否则IE将无效。

    <table class="table table-striped responsive-utilities jambo_table" id="myTable">
                                    <thead>
                                        <tr class="headings">
                                            <th>Employee No.</th>
                                            <th>Username</th>
                                            <th>Name</th>
                                            <th>Status</th> 
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php 
                                        foreach($EMPLOYEES as $employee){?>
                                        <tr>
                                            <td><?php echo $employee->empnum; ?></td>
                                            <td><?php echo $employee->username; ?></td> 
                                            <td><?php echo $employee->name; ?> <?php echo $employee->lastname; ?></td>
                                            <td><?php 
                                            if ($employee->hasClockOut==1){
                                                echo '<a class="label label-danger">Inactive</a>';
                                            }else {
                                                echo '<a class="label label-success">Active</a>';
                                            }
                                            ?></td> 
                                        </tr>
                                        <?php } ?>
                                    </tbody>
                                </table>

我改变了这个:

struct Color
{
    public static readonly Color None = new Color(),
    public static readonly Color Red = new Color(1),
    public static readonly Color Green = new Color(2),
    public static readonly Color Blue = new Color(100)
    private int data1;
    private int data2;
    private Color(int channel){...}
}

到此:

<form class="form-inline bidding" ID="rb" name="IamBidding" ACTION="">

并且该脚本适用于所有3种浏览器。