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
The difference between gateway and router
How to recover files emptied from Recycle Bin
How to fix libcurl.dll missing from your computer
Delete exif information
WiFi shows no access to the Internet
My computer can't open it by double-clicking it.
How to restore friends after being blocked on TikTok
Introduction to javascript special effects code