I'm trying to put my first Ajax to use by creating a login form.

To get there, I'm attempting to modify the first tutorial I've found which
I understand enough to understand what it's doing and how it's working
with a ColdFusion backend.

Anyway, my first question is:  How do I modify the code below to
send an email address (form.email_address) and password (form.password)
to the url: "request_processor.cfm"?

The code below was just for a form with a select which, when the value changed, would cause an item in a db to be read and appear. I'm modifying it for email_address
and password fields, with a submit button.

        $(document).ready(function(){
$('#contentdiv').html(' '); $('#idm').change(function(){ var formval = {idm:$(this).val()}; $.ajax({
                                 type: "POST",
                                 url: "request_processor.cfm",
                                 dataType: "json",
                                 data: formval,
                                 success: function(response){
$('#contentdiv').empty().fadeIn(1000).append(response.main_dish);
                                                             }
}); }); });

So, I'd have:

$(document).ready(function(){

   $('#contentdiv').html(' ');

      $('#login-button').click(function(){
var formval = {email address, password:$(this).val()}; <--- (???)

            $.ajax({
                           type:"post",
                           url:"request_processor.cfm",
                           dataType:"json",
                           data:formval
                           success:function(response){
$('#contentdiv').empty().fadeIn(1000).append(response.login_message);
                                             }
            });
    });
});


What changes need to be made?

Thanks for any help!

Rick

Reply via email to