Solved

Submit form to ajax from onChange (Select box)

Posted on 2012-04-12
2
247 Views
Last Modified: 2012-04-12
I have a page with an ajax function on which works absolutely fine. I click on the submit button and it executes my ajax code no problem with the following code ..

onsubmit="ajaxQuote('ajaxQuoteCalculation.asp',this);"

I am picking up the form variables in the ajax function with:

      str = 'leaseAmount=' + frm.leaseAmount.value + '&payYears=' + frm.payYears.value + '&sendMail=' + frm.sendMail.value + '&school=' + frm.school.value  + '&freq=' + frm.freq.value + '&description=' + frm.description.value

and then closing the ajax function with:

   xmlHttp.open("POST",SaveURL,true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", str.length);
    xmlHttp.setRequestHeader("Connection", "close");

****************************************************************
I need to be able to trigger the ajax function whenever a value is changed in one of the drop down select boxes  and also when the main value (in a text box) is changed. It must recalculate on any change made. How do I do this?
0
Comment
Question by:Laride
2 Comments
 
LVL 23

Accepted Solution

by:
basicinstinct earned 300 total points
ID: 37836477
add this to your selects

onchange="ajaxQuote('ajaxQuoteCalculation.asp',this.form);"
0
 

Author Closing Comment

by:Laride
ID: 37838578
Thanks .... I was just    '.form'  off the correct solution myself!

works a treat.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question