I'm trying to pass a variable to a javascript function, but I'm not sure what's going on as I am primarily a PHP person.
Solution 1:
You're almost perfect, just a few things:
You missed a )
in your onclick
event. Just add it to the end and it should work.
You don't need all that try..catch
stuff, unless you need to support Internet Explorer 6, so you can just get rid of it and leave ajaxRequest = new XMLHttpRequest()
.
Post a Comment for "Pass A Variable To An Ajax Function"