Jump to content

json, ajax help


Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.