6.15ajax?????????
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了6.15ajax?????????相关的知识,希望对你有一定的参考价值。
?????????doctype trap localhost cas point pac ?????? connect style
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <link rel="stylesheet" type="text/css" href="public/bootstrap/css/bootstrap.min.css"> <script src="public/jquery/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script> <script src="public/bootstrap/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script> <title>Document</title> <style type="text/css"> .sousuo{ width: 100px; height: 30px; background-color: #117A8B; border-radius: 3px; text-align: center; line-height: 30px; color: white; } .sousuo:hover{ cursor: pointer; } </style> </head> <body> ?????????<label><input type="checkbox" onclick= "qx1(this)">??????</label><br /> <label ><input type="checkbox" name="" class="qy" value="??????" />??????</label> <input type="checkbox" name="" class="qy" value="??????" />?????? <input type="checkbox" name="" class="qy" value="??????" />?????? <input type="checkbox" name="" class="qy" value="??????" />?????? <input type="checkbox" name="" class="qy" value="??????" />?????? <input type="checkbox" name="" class="qy" value="??????" />??????<br /> ???????????????<input type="checkbox" onclick= "qx2(this)" />??????<br /> <input type="checkbox" name="" class="zl" value="??????" />?????? <input type="checkbox" name="" class="zl" value="??????" />??????<br /> ???????????????<input type="checkbox" onclick= "qx3(this)" />??????<br /> <input type="checkbox" name="" class="fw" value="3???1???" />3???1??? <input type="checkbox" name="" class="fw" value="??????" />?????? <input type="checkbox" name="" class="fw" value="2???1???" />2???1??? <input type="checkbox" name="" class="fw" value="?????????" />????????? <input type="checkbox" name="" class="fw" value="1???1???" />1???1??? <input type="checkbox" name="" class="fw" value="4???2???" />4???2???<br /> ????????????<input type="text" name="" id="gjz" value="" /> <div class="sousuo" onclick="sousuo()">??????</div> <table border="1" cellspacing="0" cellpadding="0" class="table table-bordered"> </table> </body> </html> <script type="text/javascript"> var tab = document.getElementsByTagName("table")[0]; var qy = document.getElementsByClassName("qy"); var zl = document.getElementsByClassName("zl"); var fw = document.getElementsByClassName("fw"); //loadData(??????,??????,??????,??????);//???????????? sousuo(); function loadData(tt,condition,condition1,condition2){ $.ajax({ type:"post", url:"zlcl.php", async:true, data:{ "type":"chazhao", "nm":tt, "condition":condition, "condition1":condition1, "condition2":condition2 }, dataType:"json", success:function(data){ var str =""; var str ="<td>??????</td><td>?????????</td><td>??????</td><td>??????</td><td>??????</td><td>????????????</td><td>????????????</td>"; for(var i=0 ;i<data.length; i++){ str +="<tr>"; for(var j=0;j<data[i].length;j++){ //????????????????????????????????? if(j == 1){ str +="<td>"+data[i][j].replace(tt,"<span style=???color:red;???>"+tt+"</span>")+"</td>"; //}else{ //str +="<td>"+data[i][j]+"</td>"; //} } str +="</tr>"; } tab.innerHTML = str; } }); } function sousuo(){ var condition = ??????; var quYu = $(".qy"); for(var i=0;i<quYu.length;i++){ if(quYu[i].checked == true){ condition +=??? quyu="???+$(quYu[i]).val()+???" or???; } } condition = condition.substr(0,condition.length-2); //=================== var condition1 =??????; var zulin = $(".zl"); for(var j=0;j<zulin.length;j++){ if(zulin[j].checked == true){ condition1 +=??? zulinlx="???+$(zulin[j]).val()+???" or???; } } condition1= condition1.substr(0,condition1.length-2); //====================== var condition2 =??????; var fangwu = $(".fw"); for(var k=0;k<fangwu.length;k++){ if(fangwu[k].checked == true){ condition2 +=??? fangwlx="???+$(fangwu[k]).val()+???" or???; } } condition2= condition2.substr(0,condition2.length-2); var gjz = document.getElementById("gjz").value; loadData(gjz,condition,condition1,condition2); } function qx1(t){ for(var i=0;i<qy.length;i++){ if(t.checked){ qy[i].checked=true; }else{ qy[i].checked=false; } } } function qx2(t){ for(var i=0;i<zl.length;i++){ if(t.checked){ zl[i].checked=true; }else{ zl[i].checked=false; } } } function qx3(t){ for(var i=0;i<fw.length;i++){ if(t.checked){ fw[i].checked=true; }else{ fw[i].checked=false; } } } </script>
??????
<?php $type = $_POST[???type???]; $conn = new mysqli("localhost","root","","ceshi"); $conn->connect_error?die("????????????"):""; switch($type){ case "chazhao": $nm = $_POST[???nm???]; $condition = $_POST[???condition???]; $condition1 = $_POST[???condition1???]; $condition2 = $_POST[???condition2???]; $condit = ??? 1=1 ???; if($nm != ??????){ $condit .=" and (name like ???%{$nm}%??? or quyu like ???%{$nm}%???) "; } if($condition != ??????){ $condit .= ???and (???. $condition.???)???; //quyu="??????" select * from fwzl where ??? 1=1 ???and (name like ???%{$nm}%??? or quyu like ???%{$nm}%???)and quyu="??????" } if($condition1 != ??????){ $condit .= ???and (???. $condition1.???)???; } if($condition2 != ??????){ $condit .= ???and (???. $condition2.???)???; } $sql = "select * from fwzl where $condit "; $result = $conn->query($sql); $attr = $result->fetch_all(); echo json_encode($attr); break; } ?>
php??????
?????????
??????
??????
??????
??????
??????
?????????????????????
??????
??????
?????????????????????
3???1???
??????
2???1???
?????????
1???1???
4???2???
????????????
??????
?????? | ????????? | ?????? | ?????? | ?????? | ???????????? | ???????????? |
1 | ???????????? | ?????? | 100 | 1000 | ?????? | 3???1??? |
2 | ??????????????? | ?????? | 150 | 1599 | ?????? | ?????? |
3 | ??????????????? | ?????? | 200 | 500 | ?????? | 2???1??? |
4 | ??????????????? | ?????? | 110 | 1200 | ?????? | ????????? |
5 | ??????????????? | ?????? | 80 | 2000 | ?????? | 4???2??? |
6 | ???????????? | ?????? | 90 | 3000 | ?????? | 1???1??? |
7 | ???????????? | ?????? | 300 | 5000 | ?????? | ????????? |
以上是关于6.15ajax?????????的主要内容,如果未能解决你的问题,请参考以下文章
html PHP代码片段: - AJAX基本示例:此代码演示了使用PHP和JavaScript实现的基本AJAX功能。