Zend Framework :: Ajax Requests

I am looking for any library that would facilitate Ajax in Zend (if one exists). Also, someone can shed light on the built-in Ajax support that comes with ZF. I tried searching on the Internet but was not satisfied with the results.

-DevD

+3
source share
4 answers

altough jQuery is well integrated with the Zend Framework. There is a libray in the / extras folder.

There are helpers for AjaxRequests, various View widgets and for loading libraries from Google / AOL CDN.

For more information, I would suggest visiting the Zend Framework Documentation for:

Zendx jquery

+2
source

Dojo Zend Framework, ajax.

Dojo ToolKit, , , ajax ( xhrGet xhrPost)

, , dojo Zend Framework. Zend_Dojo

,

+1

Zend Framwork 2.

, Skareton Wasabilib https://github.com/WasabiLib/wasabilib_zf2_skeleton_application. .

, .

: jQuery, ZF2

  • application.config.php.
  • wasabilib.min.js jquery layout.phtml

.phtml :

<form id="simpleForm" class="ajax_element" action="simpleFormExample" method="POST">
<input type="text" name="written_text">
<input type="submit" value="try it">
</form>

phtml , .

:

public function simpleFormExampleAction(){
    $postArray = $this->getRequest()->getPost();
    $input = $postArray['written_text'];
    $response = new Response(new InnerHtml("#element_simple_form","Server     Response: ".$input));
    return $this->getResponse()->setContent($response);
}

"ajax_element", , xmlhttp-. , . , "simpleForm". - "//", .

WasabiLib\Ajax\Response. InnerHtml , html . "element_simple_form". InnerHtml . , #yourElementId .yourClassSelector. "#" ".

The second parameter is the text that you want to fill with this element.

The response object can handle many more answers that you can add with

$response->add($anotherResponseType);

A list of possible response types is on the wasabilib.org home page.

The module is built to handle ajax response requests in a very simple way. Once you understand the behavior, you can handle almost all of the practical needs of ajax.

0
source

Source: https://habr.com/ru/post/1738454/


All Articles