Calls an AJAX function directly, without binding to any existing elements, the DOM element is created and removed on-the-fly If directCall is false, it will return a jQuery a element, if not, it will return an jqXHR object
function_name: string, name of the alias defined in Phery::instance()->set() inside PHP
args: object or array or variable, the best practice is to pass an object, since it can be easily accessed later through PHP, but any kind of parameter can be passed, from strings, ints, floats, and can also be null (won't be passed through ajax)
attr: object, set any additional information about the DOM element, usually for setting another href to it. eg: {href: '/some/other/url?p=1'}
direct_call: boolean, defaults to true, setting this to false, will return the created DOM element (invisible to the user) and can have events bound to it, but will be removed right after the response is processed
phery
.remote('remote', {'key':'value'}, {'href': '/new/url'}, false)
.on({
'phery:done': function(){
$('body').append($(this));
}
})
.phery('remote');
When setting direct_call to false, the returned element can be reused many times, using phery('remote'), to explicitly remove it, you need to call phery('remove')
If you wish to remove it as soon as the call ends, pass in the attr parameter, the temp option:
If direct_call is undefined or true (the default) the element is removed and cleaned after each remote call.