Create a new phery_response instance for chaining, for one liners
phery_response
__construct
([string $selector = null])
-
string
$selector: Create the object already selecting the DOM element
Show an alert box
-
string
$msg: Message to be displayed
Append string/HTML to target(s)
-
string
$content: Content to be appended to the selected element
-
string
$selector: [optional] Optional jquery selector string
Set the attribute of a jQuery selector
Example:
$phery_response->attr('href', 'http://url.com', 'a#link-' .
$args['id']);
-
string
$attr: HTML attribute of the item
-
string
$selector: [optional] Provide the jQuery selector directly
-
$data
Call a javascript function.
Warning: calling this function will reset the selector jQuery selector previously stated
-
string
$func_name: Function name
-
mixed
$args,...: Any additional arguments to pass to the function
Clear the selected attribute.
Alias for attr('attrname', '')
-
string
$attr: Name of the attribute to clear, such as 'innerHTML', 'style', 'href', etc
-
string
$selector: [optional] Provide the jQuery selector directly
Add a command to the response
-
int
$cmd: Integer for command, see phery.js for more info
-
array
$args: Array to pass to the response
-
string
$selector: Insert the jquery selector
Set the HTML content of an element.
Automatically typecasted to string, so classes that respond to __toString() will be converted automatically
-
string
$content
-
string
$selector: [optional] Provide the jQuery selector directly
Shortcut/alias for jquery($selector)
-
string
$selector: Sets the current selector for subsequent chaining
Sets the selector, so you can chain many calls to it
-
string
$selector: Sets the current selector for subsequent chaining
$phery_response
->fadeTo(0,0)
->css(array('top' => '10px', 'left' => '90px'));
Merge another response to this one.
Selectors with the same name will be added in order, for example:
function process()
{
// will execute before
// there will be no more "a.links", so the addClass() will fail silently
$response2->jquery('a.links')->addClass('red');
return $response->merge($response2);
}
Prepend string/HTML to target(s)
-
string
$content: Content to be prepended to the selected element
-
string
$selector: [optional] Optional jquery selector string
Creates a redirect
-
string
$url: Complete url with http:// (according W3C http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30)
Remove the current jQuery selector
-
string
$selector: Set a selector
Return the JSON encoded data
string
render
()
Compile a script and call it on-the-fly.
There is a closure on the executed function, so to reach out global variables, you need to use window.variable Warning: calling this function will reset the selector jQuery selector previously stated
-
string|array
$script: Script content. If provided an array, it will be joined with ;\n
->script(array("if (confirm('Are you really sure?')) $('*').remove()"));
Set the text of an element.
Automatically typecasted to string, so classes that respond to __toString() will be converted automatically
-
string
$content
-
string
$selector: [optional] Provide the jQuery selector directly
Magically map to any additional jQuery function.
To reach this magically called functions, the jquery() selector must be called prior to any jquery specific call
Magic function to get data appended to the response object
void
__get
( $name)
Magic function to set data to the response before processing
void
__set
( $name, $value)
Return the JSON encoded data
if the object is typecasted as a string
string
__toString
()