I am trying to modify a JavaScript code for livesearch functions, (also known as AJAX etc...) which uses XMLHttpRequest. It's all working fine with one search form on the page, but I'm trying to have multiple forms using this on the same page. So, I thought, I should simply pass the name of the form as a parameter, which will then be passed on to the php scripts which will know what to do with it.
Since I am not very experienced with JavaScript, I'm doing something wrong. Originally, this was used for one input box whose name = "q":
Code: Select all
function liveSearchDoSearch() {
liveSearchReq.open("e;GET"e;, liveSearchRoot + "e;/lsearch?q="e; + document.forms.searchform.q.value + liveSearchParams);
}Code: Select all
function liveSearchDoSearch(which){
liveSearchReq.open("e;GET"e;, liveSearchRoot + "e;/lsearch?"e; + which + "e;="e; + document.forms.searchform.q.value + liveSearchParams);
}Furthermore (once the above gets fixed), I will need to change the portion:
Code: Select all
document.forms.searchform.q.valueCode: Select all
document.forms.searchform.which.valueThese are some very basic questions -- I am new to JavaScript, and I'd be very grateful for some hints.
All best,
Tench