index.html內容如下:
讓客戶滿意是我們工作的目標,不斷超越客戶的期望值來自于我們對這個行業的熱愛。我們立志把好的技術通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領域值得信任、有價值的長期合作伙伴,公司提供的服務項目有:域名與空間、網絡空間、營銷軟件、網站建設、新城網站維護、網站推廣。<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
<style type="text/css" media="screen">
ul{
list-style: none;
}
</style>
</head>
<body>
<h2>User Login</h2>
<ul>
<li>Username</li>
<li><input type="text" name="username" id="username" placeholder="please enter username" class="ipt-style" /></li>
<li>Password</li>
<li><input type="password" name="password" id="password" placeholder="plaease enter password" class="ipt-style" /></li>
<li><input type="button" name="ajaxBtn" id = "ajaxBtn" value="ajaxLogin" /></li>
</ul>
<script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#ajaxBtn").click(function(){
$.getJSON("index.php",$(".ipt-style").serialize(),function(res){
console.log(res);
});
});
});
</script>
</body>
</html>
index.php內容如下:
<?php
header("Content-type:text/html;charset=utf-8");
$username = $_GET['username'];
$password = $_GET['password'];
$res = array('code'=>1,'msg'=>'','data'=>[]);
if($username == 'ceshi' && $password == '123456'){
$res['msg'] = "success";
}else{
$res['code'] = 0;
$res['msg'] = 'fail';
}
echo json_encode($res);
另外有需要云服務器可以了解下創新互聯cdcxhl.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
網頁標題:$.getJSON()應用-創新互聯
網頁鏈接:http://www.yijiale78.com/article48/csihhp.html
成都網站建設公司_創新互聯,為您提供品牌網站設計、定制開發、微信小程序、域名注冊、用戶體驗、云服務器
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯