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   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 33 This week: 1All time: 10,972 This week: 560Up
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: 58 packages by
Country: Russian Federation Russian Federation
Age: ???
All time rank: 185254 in Russian Federation Russian Federation
Week rank: 109 Up7 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 13x

Documentation

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:33
This week:1
All time:10,972
This week:560Up