Home  >  Article  >  Backend Development  >  ThinkPHP处理Ajax返回的方法_PHP

ThinkPHP处理Ajax返回的方法_PHP

WBOY
WBOYOriginal
2016-05-31 19:27:26752browse

本文实例讲述了ThinkPHP处理Ajax返回的方法,分享给大家供大家参考。具体实现方法如下:

在ThinkPHP中可以直接使用ajax返回:

代码如下:

$.post(handleUrl,{username:username.val(),content:content.val()},function(data) {
//这里是接收返回来的内容。},'json');

而在处理过程中可以使用这个函数处理:

代码如下:

$this->ajaxReturn(要返回的内容,'json(json格式返回)');

希望本文所述对大家的ThinkPHP框架程序设计有所帮助。

Statement:
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