We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How To Call (included .php file in Controller) To Javascript

Dear members, please help me.. Forgive me for my less precise title, since I'm very new to php, phalcon, json and ajax.

So I have this Fullcalendar Jquery Plugin from Bootstrap Template and I want to use it in my web. Since this only a template so I googling how to save the event I made from the calendar into the database. And I found this CRUD example in pure php, the code is here.

I put the javascript at index.php into jquery.fullcalendar.js at public/js folder (if I put it into IndexController, the calendar won't show up), and then the file load.php, insert.php, update.php, delete.php I included into CalendarController as exampled, but.. the event still doesn't saved into the database, in fact it wont show up in the calendar.

My question is how to call the file load.php, insert.php, update.php, delete.php at jquery.fullcalendar.js (in line 21, 32, 51, 68, 85) .. and what am I missing here..

Thank you for your time and support :)

edited May '18

What is this? Why you even do include? Why you don't create 4 seperate actions and move code from those include files to them and use phalcon objects and methods to do this? I'm thinking that you don't even know basics of php OOP and you are trying to use phalcon. First learn how to program in PHP(like learn OOP) then start using framework.

yes, sorry for my lack of knowledge, because I learn php and phalcon just from 3 months ago.. Thank you for your support :)

As Wojciech said, this sort of question demonstrates your lake of knowlege in PHP, i was advise you to learn more basic PHP technologies and OOP before you start learning how to use an MVC framework. Try starting here: https://www.youtube.com/user/phpacademy

yes Jake thank you for your advice :)



43.9k

Hi,

I learn php and phalcon just from 3 months ago

good !

and welcome.

Also, if you're a noob in javascript (fullcalendar is written in javascript), first stick to php. Learn some basics such as https://code.tutsplus.com/tutorials/object-oriented-php-for-beginners--net-12762 or any other like the videos cited above

then, try all the tutorials and the example apps (and read the code carefully, do not just copy/paste) provided in the excellent and extensive phalcon documentation