PHP Classes

Mezon AJAX Application: Create AJAX applications using the Mezon framework

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-01-17 (4 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 18 This week: 18All time: 10,494 This week: 11Up
Version License PHP version Categories
mezon-ajax-applicati 1.0MIT/X Consortium ...5PHP 5, Libraries, AJAX
Description Author

This package facilitates the creation of AJAX applications using the Mezon framework.

It provides a trait that can generate several types of responses to return when handling AJAX requests encoding the response data in JSON format.

The package also provides an AJAX application class that can generate responses to throw exceptions on the server-side. It will create a reply in JSON format that the browser-side code in JavaScript can handle as a JavaScript exception.

Picture of Alexey Dodonov
  Performance   Level  
Name: Alexey Dodonov <contact>
Classes: 53 packages by
Country: Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 9x

Details

Ajax Application

Intro

Mezon Framework provides simple class for creating ajax applications. This class uses all functionality of the Mezon Application Class also provides usefull functionality:

Installation

Just print in console

composer require mezon/ajax-application

And that's all )

Learn more

More information can be found here:

It will be great if you will contribute something to this project. Documentation, sharing the project in your social media, bug fixing, refactoring, or even submitting issue with question or feature request. Thanks anyway ) I'll be very glad if you'll press "STAR" button )

Exception handling

For better debugging exception handling is performed in a special way. If the ajax request will be failed to process, then on the front end you will get JSON object with fields:

  • code - code of the occured error;
  • message - textual description of the occured error;
  • call_stack - call stack for the call wich lead to the error.

Finishing request processing

After finishing request processing you can mark it as successfull:

function ajaxRequestSuccess(): void

Wich will return {"code": 0}

Or return any other result:

function ajaxRequestResult($result): void

In this case $result will be encoded in JSON and outputted.

Or in case of the error you can call

function ajaxRequestError(string $message, int $code = - 1): void

Wich will return object {"code": $code, "message": "message"}

  Files folder image Files  
File Role Description
Files folder imageMezon (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  Mezon  
File Role Description
Files folder imageApplication (2 files)

  Files folder image Files  /  Mezon  /  Application  
File Role Description
  Plain text file AjaxApplication.php Class Class source
  Plain text file AjaxMethodsTrait.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:18
This week:18
All time:10,494
This week:11Up
For more information send a message to info at phpclasses dot org.