How ThinkPHP handles Ajax returns

  • 2021-08-05 09:27:32
  • OfStack

This article describes the example of ThinkPHP processing Ajax return method, to share for your reference. The specific implementation method is as follows:

In ThinkPHP, you can use ajax directly to return:

$.post(handleUrl,{username:username.val(),content:content.val()},function(data) {
// Here is the content returned from receiving. },'json');

In the process of processing, you can use this function to handle:

$this->ajaxReturn( What to return ,'json(json Format return )');

I hope this article is helpful to everyone's ThinkPHP framework programming.


Related articles: