2014-04-30 60 views
0

以前用过的脚本,现在它突然不起作用。它返回一个意外的令牌>错误,这没有任何意义,因为我没有在这里编辑任何东西,但是当删除其他代码时,我添加它仍然不起作用。我尝试修复它后,按钮不会立即触发代码,但这是另一个问题。你们能看到为什么吗?意外的令牌>

function dologin() { 
    var senddata = $('#form').serialize(); 

    $.ajax({ 
     type: 'post', 
     url: 'herpaderp', 
     data: senddata, 
     crossDomain: true, 
     dataType: 'json', 
     success: function (response) { 
      if (response.success == true) 
       window.location.href = "herpderp"; 
      else if (response.success == false) 
       navigator.notification.alert("Feil brukernavn eller passord", null, "Mislykket innlogging", "OK"); 
      else 
       alert("Noe gikk galt, kontakt administrator"); 
     }, 
     error: function (XMLHttpRequest, textStatus, errorThrown) { 
      console.log("Status: " + textStatus); 
      console.log("Error: " + errorThrown); 
     } 
    }); 
    return false; 
}; 
+0

听起来像你的'url'无法加载。 – putvande

+3

检查*服务器应答(网络选项卡或Fiddler2等数据包检查器)。它在HTML中响应(可能是因为服务器错误)。 – h2ooooooo

+0

网址刚刚被删除,因为我不想分享它。 – romeo

回答

-1

似乎现在工作,不知何故,这是我的HTML代码被打破。谢谢你们的帮助!