Solved

Submit form to ajax from onChange (Select box)

Posted on 2012-04-12
2
242 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now