1. 程式人生 > >跨域自動登錄

跨域自動登錄

title cti script json set var tst pos idc

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
    </script>
</head>
<body>
<a href="#" onclick="goto()">點擊跳轉</a>

<script type="application/javascript">
    function
goto() { var url = "http://www.bidchance.com/logon.do"; var userid = "xxxxx"; var pwd = "yyyyy"; var url_to = "http://www.bidchance.com/info-gonggao-30138261.html"; $.ajax({ url: url, type: "post", data: { userid: userid, pwd: pwd }, dataType:
‘jsonp‘, // 跨域訪問 crossDomain: true, success: function (msg) { console.log(msg); }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log(XMLHttpRequest.status); console.log(XMLHttpRequest.readyState); console.log(textStatus);
if (XMLHttpRequest.readyState == 4) { // 響應完成 window.open(url_to); } } }); } </script> </body> </html>

跨域自動登錄