使用ajax进行汽车详情表的查询
生活随笔
收集整理的這篇文章主要介紹了
使用ajax进行汽车详情表的查询
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
主界面代碼
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>汽車詳情表</title><script type="text/javascript" src="0621popwindow/jquery-1.11.2.min.js"></script><script src="0621popwindow/tanchuang.js"></script><link href="0621popwindow/tanchuang.css" rel="stylesheet" type="text/css" /></head><body> <table width="100%" border="2" cellpadding="0" cellspacing="1"><tr><td>名稱</td><td>類型</td><td>時間</td><td>操作</td></tr><?PHPinclude("DBDA.class.php");$db=new DBDA();$sql="select * from car";$re=$db->query($sql);foreach ($re as $v){echo "<tr><td>{$v[1]}</td><td>{$v[2]}</td><td>{$v[3]}</td><td><input type='button' value='查看詳情' code='{$v[0]}' class='anniu'></td> </tr>";}?> </table></body> <script type="text/javascript"> $(document).ready(function(e){$(".anniu").click(function(){var code = $(this).attr("code");alert(code);z$.ajax({url:"0624carchuli.php",data:{code:code},type:"POST",dataType:"TEXT",success:function(data){alert(data);var lie=data.split("^");var html = "<div class='xq'>代號:"+lie[0]+"</div><div class='xq'>名稱:"+lie[1]+"</div><div class='xq'>系列:"+lie[2]+"</div><div class='xq'>上市時間:"+lie[3]+"</div><div class='xq'>油耗:"+lie[4]+"</div><div class='xq'>功率:"+lie[5]+"</div><div class='xq'>排量:"+lie[6]+"</div><div class='xq'>價格:"+lie[7]+"</div>";var win = new Window({width : 300, //寬度height : 400, //高度title : '汽車詳情信息', //標題content : html, //內容isMask : true, //是否遮罩//buttons : button, //按鈕isDrag:true,//是否移動});}})}) })</script> </html>
?
?處理界面代碼
<?php /*** Created by PhpStorm.* User: Administrator* Date: 2016/6/24* Time: 20:37*/$code=$_POST["code"];include("DBDA.class.php"); $db=new DBDA();$sql="select * from car where code='{$code}'";$re=$db->query($sql);echo implode("^",$re[0]);
轉載于:https://www.cnblogs.com/pangchunlei/p/5618872.html
總結
以上是生活随笔為你收集整理的使用ajax进行汽车详情表的查询的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【BZOJ-2599】Race
- 下一篇: git入门-分支