Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 最新的Safari不使用jQuery中的location.href_Php_Jquery_Html_Safari_Mobile Safari - Fatal编程技术网

Php 最新的Safari不使用jQuery中的location.href

Php 最新的Safari不使用jQuery中的location.href,php,jquery,html,safari,mobile-safari,Php,Jquery,Html,Safari,Mobile Safari,有人能回答这个问题吗 基本上,我已经用尽了所有可能的答案,从其他问题在这里,我是驱动打开一个新的求助电话 问题是。。。我有一个带有登录表单的登录页面。submit按钮附带了jQuery单击功能。click函数有一个ajax调用,用于一些php检查DB。成功后,该位置将被重新定向到另一个页面。现在,除了最新版本的safari外,所有浏览器都可以使用此功能!我还尝试了不同版本的jQuery。这是非常令人沮丧的。请参阅下面的代码以了解您的想法 如有任何建议/解决方案,将不胜感激 提前谢谢 ------

有人能回答这个问题吗

基本上,我已经用尽了所有可能的答案,从其他问题在这里,我是驱动打开一个新的求助电话

问题是。。。我有一个带有登录表单的登录页面。submit按钮附带了jQuery单击功能。click函数有一个ajax调用,用于一些php检查DB。成功后,该位置将被重新定向到另一个页面。现在,除了最新版本的safari外,所有浏览器都可以使用此功能!我还尝试了不同版本的jQuery。这是非常令人沮丧的。请参阅下面的代码以了解您的想法

如有任何建议/解决方案,将不胜感激

提前谢谢

------------更新----------


任何遇到这个问题的人,我提出的解决方案是用AngularJS重新编写解决方案。我建议你也这样做

希望这有帮助

------------HTML--------------

试试看:

------------HTML--------------


任何遇到这个问题的人,我提出的解决方案是用AngularJS重新编写解决方案。我建议你也这样做

谢谢,但同样的事情也会发生。我的页面刚刚刷新,没有重新定向到下一页可以再试一次,使用jQuery(window).load()而不是jQuery(document).ready()@JoshEdwards,我也更新了上述代码,您可以直接使用:)谢谢你的更新,但不幸的是还是一样!在发布之前,您是否正在测试这些解决方案?这对你有用吗?
<form id="loginFRM" style="text-align: center;">
      <input style="margin:20px; padding-left:5px;" id="username" name="username" type="text" placeholder="Username...">
      <br>
      <input style="margin:20px; padding-left:5px;" id="password" name="password" type="password" placeholder="Password...">
      <br>
      <input style="margin:20px; background-color: white; border: none; padding:10px; padding-left:30px; 
             padding-right:30px;" id="loginBtn" type="submit" value="Login" onclick="return false;">
    </form>
$(document).ready(function(){
  $('#loginBtn').click(function(){
    var username = $("#username").val(),
            password = $("#password").val();

    if(username != "" && password != ""){
      $.ajax({
        type: "GET",
        url: './server/index.php',
        data: {
          username: username,
          password: password
        },
        success: function(response)
        {
          rowCount = response.ResultSet.RowCount;
          if(rowCount > 0){
              window.setTimeout(function(){ location.href = "index.html"; },0);
              return false;
          }
          else{
            alert('Incorrect details');
          }
        }
      });
    }else{
      alert('Incorrect details');
    }

    return false;

  });
});
<form id="loginFRM" style="text-align: center;">
      <input style="margin:20px; padding-left:5px;" id="username" name="username" type="text" placeholder="Username...">
      <br>
      <input style="margin:20px; padding-left:5px;" id="password" name="password" type="password" placeholder="Password...">
      <br>
      <input style="margin:20px; background-color: white; border: none; padding:10px; padding-left:30px; 
             padding-right:30px;" id="loginBtn" type="submit" value="Login">
    </form>
$(window).load(function(){
  $('#loginBtn').click(function(event){
    event.preventDefault();
    var username = $("#username").val(),
            password = $("#password").val();

    if(username != "" && password != ""){
      $.ajax({
        type: "GET",
        url: './server/index.php',
        data: {
          username: username,
          password: password
        },
        success: function(response)
        {
          rowCount = response.ResultSet.RowCount;
          if(rowCount > 0){
              window.setTimeout(function(){ location.href = "index.html"; },0);
              return false;
          }
          else{
            alert('Incorrect details');
          }
        }
      });
    }else{
      alert('Incorrect details');
    }

    return false;

  });
});