public __construct(string $name, string $question = '')

Set up an AJAX callback

  • param string $name JavaScript function name to be created
  • param string $question prompt with this question if set The $name is used as the generated function name. Is is also POSTed to the page as the 'action' parameter.
public addFunction(string $function, string $script) : static

Add a function parameter and the script that matches the parameter type according to jQuery.ajax

public execute(array $parameters) : string

Return JavaScript that will execute a function call

  • param array<string,mixed> $parameters anything you want to pass as data to the AJAX call
  • return string of JavaScript code to be added to the page
public getPageJS() : string

Get the generated JavaScript function to be added to the page.

  • return string JavaScript function
public isMyCallback(array $post) : bool

Return true if the post is from this AJAX call

  • param array<string,string> $post
protected array $conditions = []
  • var array<string,string>
protected string $name
protected string $question
© 2024 Bruce Wells
Search Namespaces \ Classes