Ajax allows you to delete data and View Details. ajax allows you to view details.

Source: Internet
Author: User

Ajax allows you to delete data and View Details. ajax allows you to view details.

Use bootstrap, jquery, and ajax to display some data, add the delete function, and click it to bring up the modal box details function.

Main. php

<! 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> untitled document </title> <link type =" text/css "href = ".. /FENGZHUANG/bootstrap/css/bootstrap.min.css "rel =" external nofollow "rel =" stylesheet "/> // introduce the bootstrap css file <script src = ".. /FENGZHUANG/jquery-3.1.1.min.js "> </script> // first introduce jquery js file <script src = ".. /FENGZHUANG/bootstrap/js/bootstrap. min. js "> </script> // introduce other js files <style type = "Text/css">. xq {margin-left: 30px} </style> 

Data Loading page jiazai. php

<? Phpinclude (".. /FENGZHUANG/DBDA. class. php "); $ db = new DBDA (); $ SQL =" select * from nation order by code ASC "; $ arr = $ db-> Query ($ SQL ); // The following implementation string is like this n001 ^ Han nationality | n002 ^ Hui Nationality | n003 ^ Miao $ str = ""; the data returned on the home page is of the TEXT type, you have to convert foreach ($ arr as $ v) {$ str = $ str. implode ("^", $ v ). "|"; // concatenated string} $ str = substr ($ str, 0, strlen ($ str)-1); // remove the ending | character. Echo $ str;

Delete shanchu. php from the processing page

<?phpinclude("../FENGZHUANG/DBDA.class.php");$db = new DBDA();$code = $_POST["code"];$sql = "delete from nation where code='{$code}'";if($db->Query($sql,0)){ echo "OK";}else{ echo "NO";}

View xiangqing. php on the details page

<?php$code = $_POST["code"];include("../fengzhuang/DBDA.class.php");$db = new DBDA();$sql = "select * from nation where code='{$code}'";echo $db->StrQuery($sql);

The above is all the content of this article. I hope this article will help you in your study or work. I also hope to provide more support to the customer's home!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.