?
Solved

Submit form to ajax from onChange (Select box)

Posted on 2012-04-12
2
Medium Priority
?
251 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
basicinstinct earned 1200 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

Quick Cloud Training

Looking for some quick training on the cloud in 2 hours or less? Check out these how-to guides in AWS, Linux, OpenStack, Azure, and more!

Question has a verified solution.

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

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

770 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