Jquery ajax request to controller

Hello to community…

i am new to cakephp and i have the following problem…

In my database i have a settings table with 2 date field (date1, date2).In settings controler i recieve from database the dates values and i assign it to $date1 and $date2 variables

in view i am using the jquery fullCalendar plugin…

How can i make jquery ajax request from view to settings controller an recieve the $date1 and $date2 values so i can use those to compare with nowDate value??

i know how to make ajax request but how can i retrieve those 2 values in json format and store thos e in valiables so that i can use those in js???

(i use set(compact(‘date1’ , ‘date2’) to pass ot to ajax request or something else??)

thank you

Work through this example and it will help figure out your issue:
https://www.dereuromark.de/2014/01/09/ajax-and-cakephp/