Answer the question
In order to leave comments, you need to log in
How to properly schedule ajax on the site?
There is a website, a mini seots.net for a narrow circle of people, photo profiles, groups, and other crap.
No SEO, an audience of 20 people. The site was written on Codeigniter 3 (no need to spit, it was my first framework) and all sorts of utility functions like "add to friends" or "like" is performed by ordinary GET requests a la site.ru/page/action/parameter. There is also a server on workerman (well, I really like php), which is responsible for notifications and real-time chat
. Naturally, I didn’t really like it, I want it to be like people do. Therefore, the question is what actions to perform on ajax and how is it done correctly?
My thoughts - due to the not very high complexity of the site, I wanted to register all these things directly in js np jquery, literally "got it from the server, write it here,
How correct is my approach?
Answer the question
In order to leave comments, you need to log in
Make an API of the necessary actions (on the server side in PHP) and access it via AJAX, passing and receiving information in JSON format, and inserting it where necessary.
In js code - make one function for sending and receiving data and call it using object handlers (click on a link, button, etc.).
jquery is not needed! Use native JS.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question