This article mainly introduces the relevant information on implementing the ajax multi-select, invert, and deselect data function based on php (Thinkphp) jquery. Friends in need can refer to the following
It is recommended to have a js foundation and understand jquery and thinkphp , without further ado, here’s the code
《————HTML————》
//thinkphp循环显示把data里fid赋予多选框//可在后面加td输入参数 全选 删除
《———— jsvascript————》
《————PHP————》
public function faculty_del(){ $fid = trim($_POST['name']); //以下为查询条件 $bname['deletemark'] = 0; $res = $this->faculty_model ->where(array('fid'=>array('in',$fid))) ->save($bname); //查询条件为你的查询条件,我这边为逻辑删除,修改字段值就好 // echo $this->faculty_model->getLastSql(); // var_dump($res); // exit; if ($res) { $counts = "1"; $des = "成功"; } else { $counts = "0"; $des = "失败"; } $json_data = "{"; $json_data.= "\"counts\":".json_encode($counts).","; $json_data.= "\"des\":".json_encode($des).""; $json_data.= "}"; echo $json_data; exit; }
Because it is asynchronous, the data you send will be viewed on the console. There is no output on the current page, so do not go to the page to find it.
The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
thinkPHP3.2.3 combined with Laypage to realize the paging function
##ThinkPHP and Ajax realize the secondary linkage drop-down Menu
Based on anti-ajax push, real-time message push function implemented by PHP
The above is the detailed content of Based on Thinkphp and jquery, realize the function of ajax multi-select, invert the selection and delete data.. For more information, please follow other related articles on the PHP Chinese website!