How to call ajax to load data without refreshing in thinkphp5.0
The following tutorial column from thinkphp will introduce how thinkphp5.0 calls ajax to load data without refreshing. I hope it will be helpful to friends in need!
The controller layer is to adjust the data and return it. I won’t go into details here. The ajax part of the view layer page is written as follows
function shanchu(obj) { var code = $(obj).attr("code"); $.ajax({ url:"/index400/Test/sc", data:{code:code}, type:"POST", dataType:"TEXT", success: function(data){ if(data==0) { alert("删除失败!"); } else { $("#aaa").html(data); $(".sc").click(function(){ shanchu(this) }); } } }) } $(".sc").click(function(){ shanchu(this) })
Or you can write
shanchu() function shanchu() { $(".sc").click(function(){ var code = $(this).attr("code"); $.ajax({ url:"/index400/Test/sc", data:{code:code}, type:"POST", dataType:"TEXT", success: function(data){ if(data==0) { alert("删除失败!"); } else { $("#aaa").html(data); shanchu(); } } }) }); }
The above is the detailed content of How to call ajax to load data without refreshing in thinkphp5.0. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

