Link to home
Start Free TrialLog in
Avatar of Laride
Laride

asked on

Submit form to ajax from onChange (Select box)

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?
ASKER CERTIFIED SOLUTION
Avatar of basicinstinct
basicinstinct
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Laride
Laride

ASKER

Thanks .... I was just    '.form'  off the correct solution myself!

works a treat.