jQuery and Ajax

I do not know a lot about Ajax.  Can you use Ajax to save info to a DB table as someone fills out a form on a select option change?  If someone fills out an order form on my website, I want to store certain info about what they were filling out.  If they don't make a purchase, send them an email reminding them about the products they were about to order but did not.
LVL 8
rgranlundAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
Yes.  But to be clear, the ajax request will just send the data to the server.  On the server you need a script that "receives" the data connects to the db and stores the data.  What are you using on the backend (PHP,JSP,ASP)?
Big MontyWeb Ninja at largeCommented:
here's a simple ajax script that sends back data to the server. as mentioned, you need a server side language to then process that data:

                    var data = {
                        mode: 'offer',
                        offerID: $('#hdnOfferID').val(),
                        offer: $('#txtOffer').val(),
                        active: $('#chkOfferActive').prop('checked'),
                        desc: $('#txtOfferDescription').val(),
                        categoryID: $('#selCategory').val()
                    }

               $.ajax({
                    type: "POST",
                    data: data,
                    url: url,
                    success: function (result) {
                        alert('Record updated successfully!');
                    }
                });

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rgranlundAuthor Commented:
@All
I'm going to use a PHP query to store a few form fields and I need to do it on a specific click.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.