This time I will bring you how to scientifically interact with front-end and back-end data. What are the precautions for front-end and back-end data interaction? Here are practical cases, let’s take a look.
HTML assignmentJS assignmentscript fills JSONAJAX gets JSONWebSocket real-time transmission of data Summary1. HTML assignment output to the value or data-name of Element<div data-value="<?php echo $user_avatar;?>"></div>
<div data-avatar="https://avatars1.githubusercontent.com/u/3949015?v=3&s=40"></div>
$('div').data('avatar');
Usage suggestions: Suitable for
passing simple data, and also very suitable for binding relationships between multiple simple data and Element.
<li>nimojs <span data-userid="1" >删除</span></li> <li>nimo22 <span data-userid="2" >删除</span></li> <li>nimo33 <span data-userid="3" >删除</span></li> <li>nimo44 <span data-userid="4" >删除</span></li> <li>nimo55 <span data-userid="5" >删除</span></li></ul><script> $('span').on('click',function(){ $.post('/ajax/remove/',$(this).data('userid'),function(data){ // ... }) })</script>
Fill data into the
JavaScript variable declaration of
How to remove the first few elements of an array in php
How to copy an Excel table to make it the same size as the original
How to best set up virtual memory
The difference between footnotes and endnotes
How to solve 500 internal server error
What card is TF card?
What does screen recording mean?
Why can't the Himalayan connect to the Internet?