阿贾克斯的错误:语法错误:预期EX pression,得到了'<“得到了、错误、语法错误、阿贾克斯

2023-09-11 01:23:23 作者:靠着莪哋肩嫎ヽ

我想从我的服务器登录到另一台服务器,以我的其他网站。 但这个错误是每年一次。

 语法错误:预期EX pression,得到了'<

!< D​​OCTYPE HTML PUBLIC -  // W3C // DTD XHTML 1.0过渡//Ë
 

请帮忙。

  URL =htt​​p://www.example.co.uk/email/admin/index.php?Page=&Action=Login;
//执行console.log(URL);
//返回false;
        POSTDATA = {ss_username:用户名,ss_password:密码,行动:登录}
        $阿贾克斯({//更新页,并重定向
          键入:POST,
          网址:网址,
//跨域:真实,
          数据类型:JSONP
          数据:POSTDATA,
          成功:函数(响应){
            的console.log(响应);

          },
          错误:函数(响应){
            console.info(响应);
          }
        });
 

解决方案

无论您的其他服务器遇到一个错误(这样的反应是错误的html页面),或者你必须从更改AJAX类型JSONPXML

英语干货 歪果仁也会犯的13个语法错误,你用对了吗

I am trying to login from my server to another server to my other site. But this error comes every time.

SyntaxError: expected expression, got '<'

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//E

Please help.

url = "http://www.example.co.uk/email/admin/index.php?Page=&Action=Login";
//        console.log(url);
//        return false;
        postData = {ss_username:"username",ss_password:"password",Action:"login"}
        $.ajax({ //update page and redirect
          type: 'POST',
          url: url,
//          crossDomain: true,
          dataType: "jsonp",
          data: postData,
          success: function (response) {
            console.log(response);

          },
          error: function (response) {
            console.info(response);
          }
        });

解决方案

Either your other server encounters an error (so the response is an error html page) or you will have to change the ajax type from 'jsonp' to 'xml'