This article mainly introduces the functions of data deletion and viewing details through ajax, which is a good reference and value for learning ajax. Let’s follow the editor and take a look at this article about how ajax implements data deletion and view details functions.
Use bootstrap, jquery and ajax to display some data, add deletion functions and click to pop up the modal box details. Function
Main page main.php
无标题文档 //引入bootstrap的css文件 //先引入jquery的js文件 //再引入其它的js文件
显示数据
代号 | 名称 | 操作 |
---|
Load data page jiazai.php
Query($sql); // 下面实现的字符串是类似这样的n001^汉族|n002^回族|n003^苗族 $str = "";返回主页面的数据是TEXT型,得转换一下 foreach($arr as $v) { $str = $str.implode("^",$v)."|"; //拼接字符串 } $str = substr($str,0,strlen($str)-1); //去掉末尾的|字符。 echo $str;
Delete processing page shanchu.php
Query($sql,0)) { echo "OK"; } else { echo "NO"; }
View details page xiangqing.php
StrQuery($sql);
The above is all the content of this article, I hope it will be helpful to everyone’s learning! !
Related recommendations:
In-depth understanding of the XHR object in the first article of the ajax series
JSON data storage format for Ajax interaction with users
About multiple ajax request issues
The above is the detailed content of Ajax implements data deletion and view details functions. For more information, please follow other related articles on the PHP Chinese website!