so i want to pass that element_id along so I don't have to load an altered version of the code for each row. This is how i thought it would work but i'm missing something.. maybe i don't understand Objects..
Line 14 i'm trying to pass on the element_id as a variable to the stateChange() function, but it doesn't work.
Thanks!
Bugboy
Expand|Select|Wrap|Line Numbers
- function add_to_list(source, list, row, element_id)
- {
- xmlHttp=GetXmlHttpObject()
- if (xmlHttp==null)
- {
- alert ("Browser does not support HTTP Request")
- return
- }
- var url="add_to_list.php"
- url=url+"?source="+source
- url=url+"&list="+list
- url=url+"&row="+row
- url=url+"&rand="+Math.random()
- xmlHttp.onreadystatechange=stateChange(element_id)
- xmlHttp.open("GET",url,true)
- xmlHttp.send(null)
- }
- function stateChange(element_id)
- {
- if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
- {
- document.getElementById(element_id).innerHTML=xmlHttp.responseText
- }
- }