minimal Javascripts

Ajax response confirmCommands

Old xajax dino but can be usefully to prevent from clearing an form.

Factory::getResponseInstance()->confirmCommands(1, 'Handle the next 2 response commands?');
Factory::getResponseInstance()->html('existingForm','<form><input type="text" value="you have confirmed. the value was set to this stupid message ;-)"/></form>');

Ajax redirect

Ajax redirect the Page to an other Url. If set the second parameter, the redirect will wait this time. So you can display an message to the user "you will be redirected now". Default wait is 0 (redirects after this response command was received by the browser)

Factory::getResponseInstance()->redirect('relative or full FQ-Url', 5);

Ajax open new window or tab

Ajax response opens an new window or browser tab with the given url.

/**
* Open an new Browser-Window or Browser-Tab
*
* @param string      $sURL    url to open
* @param string|null $sTarget '_blank' '_self' default is blank
* @param bool|null   $bFocus  try to focus the new opend window. Default is false
*
* @return \Jybrid\Response\Response
* @since 0.7.9.2
*/
Factory::getResponseInstance()->openNewWindow(string $sURL, ?string $sTarget = null, ?bool $bFocus = null);

demo ajax response confirmCommands, redirect, open new window

@see confirmCommands schematic-ajax-response-confirm.php

further reading ajax response confirmCommands, redirect, open new window

@see confirmCommands schematic-ajax-response-confirm.php