# Any example to send request to controller by Ajax layout

**URL:** <https://discourse.cakephp.org/t/any-example-to-send-request-to-controller-by-ajax-layout/4412>\
**Category:** Need Help\
**Created:** [June 14, 2018, 6:23pm UTC](https://discourse.cakephp.org/t/any-example-to-send-request-to-controller-by-ajax-layout/4412 "2018-06-14T18:23:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnnyboy](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@johnnyboy](https://discourse.cakephp.org/u/johnnyboy)\
**Post date:** [June 14, 2018, 6:23pm UTC](https://discourse.cakephp.org/t/any-example-to-send-request-to-controller-by-ajax-layout/4412/1 "2018-06-14T18:23:01Z")

</div>

Hello.

I’m try, but without success, call a method on controller by ajax request.

I found examples for olders version of cakephp(2.0), but I’m using 3.5^

thanks…

---

<div class="post-metadata">

**Author:** ![FinlayDaG33k](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/finlaydag33k/32/1049_2.png) [@FinlayDaG33k](https://discourse.cakephp.org/u/FinlayDaG33k)\
**Post date:** [June 14, 2018, 7:56pm UTC](https://discourse.cakephp.org/t/any-example-to-send-request-to-controller-by-ajax-layout/4412/2 "2018-06-14T19:56:20Z")

</div>

What don’t you understand about it?  
What code are you trying, what are the errors?  
More details please

---

<div class="post-metadata">

**Author:** ![Diego](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/diego/32/296_2.png) [@Diego](https://discourse.cakephp.org/u/Diego)\
**Post date:** [June 14, 2018, 9:33pm UTC](https://discourse.cakephp.org/t/any-example-to-send-request-to-controller-by-ajax-layout/4412/3 "2018-06-14T21:33:56Z")

</div>

Examples for version 3.6

[https://sandbox.dereuromark.de/sandbox/ajax-examples](https://sandbox.dereuromark.de/sandbox/ajax-examples)

> **[dereuromark/cakephp-ajax](https://github.com/dereuromark/cakephp-ajax)**
>
> AJAX for CakePHP: A plugin to ease handling AJAX requests. - dereuromark/cakephp-ajax

---

<div class="post-metadata">

**Author:** ![jimgwhit](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/jimgwhit/32/378_2.png) [@jimgwhit](https://discourse.cakephp.org/u/jimgwhit)\
**Post date:** [June 16, 2018, 9:57pm UTC](https://discourse.cakephp.org/t/any-example-to-send-request-to-controller-by-ajax-layout/4412/4 "2018-06-16T21:57:29Z")

</div>

I am guessing you are referring to a GET request.

I recently did a guide in laravel of the basics. I really don’t want to do one for cakephp and yii2 as all are very similar, just return the JSON according to the cake docs.

Here is the guide in laravel, just very basic starter guide only:  
[https://laracasts.com/discuss/channels/guides/jquery-get-response](https://laracasts.com/discuss/channels/guides/jquery-get-response)

Also a POST  
[https://laracasts.com/discuss/channels/guides/jquery-ajax-post-example](https://laracasts.com/discuss/channels/guides/jquery-ajax-post-example)

But adapt to cakephp’s reqest style, etc

But there are ton’s of examples on the jquery site.

If using another JS framework, sorry I can’t help as I use normal javascript and jquery.
