function changemyemail(mynewemail, mynewphone, myconfirm) { httpObject = getHTTPObject(); if (httpObject != null) { httpObject.open("GET", "changeemail.php?email="+mynewemail+"&myphone=" + mynewphone + "&confirm="+myconfirm); httpObject.send(null); httpObject.onreadystatechange = setregister; } else { alert("oops!"); } }
I'd like to have them all use a single generic function:
function changesomething(myphpurl, setchangedstate) { httpObject = getHTTPObject(); if (httpObject != null) { httpObject.open("GET", myphpurl); httpObject.send(null); httpObject.onreadystatechange = setchangedstate; } else { alert("oops!"); } }
but I can't get setchangedstate to point to a function.