Message page display function

The ajax no refresh function code mentioned in the previous section is as follows:

Required Introduce the jquery file

Remove the form and modify the message.php code:


       

Modify insertdb.php code as follows:

query($sql)) { //返回1表示添加成功 echo 1; } else{ //返回0表示添加失败 echo 0; }

This way the function is realized

1, use jquery to send ajax request


##Modify message.php code:

   留言板      

留言板

搜索:

标题:
内容:

Create a new messageshowdb.php file, the code is as follows:

query($sql); if($result->num_rows>0) { while ($row=$result->fetch_assoc()) { $arr[$row["id"]]["title"]=$row["title"];//$arr[1]["title"]=$row["title"] $arr[$row["id"]]["content"]=$row["content"];//$arr[1]["content"]=$arr["content"] } } echo json_encode($arr);

The effect is shown as follows:

微信图片_20180308105842.png


Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!