jodunno Posted August 2, 2020 Share Posted August 2, 2020 Hello everyone, i do not know how to use json or ajax to accomplish anything in code. However, i have read many times about the benefits of json/ajax, which sound lovely to me. For example, i have a background settings page on my website where a user can turn on/off bg photos, select a bg color instead of photo, apply a tint color to a bg photo, select a tint color or apply a css bg pattern to the whole bg. I currently do all of this via form post, write to db, set in session, read from session, display selection accordingly. I am now wondering how i could do this using json or ajax so that the user remains on the page and json or ajax communicates with php to make the changes. Anyone know of a simple tutorial for this process? anyone willing to offer sample code or pseudo code? i have no idea how this works. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/311262-json-ajax-help/ Share on other sites More sharing options...
requinix Posted August 2, 2020 Share Posted August 2, 2020 No offense, but there are tons of PHP + AJAX tutorials out there. Have you tried reading a few articles or watching whatever YouTube videos are out there? For the most part, all you have to do is write a bit of Javascript to send the data and receive the response (and do whatever else you would otherwise do). The PHP side is less complicated than your standard page because you output straight data (using JSON) instead of some complicated webpage. If you can write a PHP script that takes the form data then you're most of the way there. And it sounds like you already have that piece. Quote Link to comment https://forums.phpfreaks.com/topic/311262-json-ajax-help/#findComment-1580273 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.