thinkpad x1 helix uses the built-in ThinkAjax of ThinkPHP to implement asynchronous transmission technology

WBOY
Release: 2016-07-29 08:47:28
Original
1217 people have browsed it

Preparation work:
① First of all, you must be able to use the ThinkPHP framework
② It is best to have some basic knowledge of ajax (you can check out Xiao Fei’s other blog post: Ajax real-time verification of whether "username/email, etc." already exists)
③ 4 js document (click here to download for free)
First paste the source code:

Copy the code The code is as follows:






< ;script type="text/javascript">
function checktitle()
{
ThinkAjax.send('__URL__/checktitle','ajax=1&title='+$('title').value,'','checkbox ');
}






Title:

Copy the code The code is as follows:


class IndexAction extends Action
{
//Homepage
public function index(){
$this->display();
}
// Check whether the title is Available
public function checkTitle()
{
if(!empty($_POST['title']))
{
$Form = D("Form");
if($Form->getByTitle($_POST[ 'title']))
{
$this->error('Title already exists');
}
else
{
$this->success('Title is available!');
}
}
else
{
$this->error('Title cannot be empty...');
}
}
}
?>


Article author: WEB Development_Xiao Fei

The above introduces the implementation method of thinkpad x1 helix using the built-in ThinkAjax of ThinkPHP to implement asynchronous transmission technology, including the content of thinkpad x1 helix. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!