lee toto
11-22-2006, 09:50 PM
1) Script Title: Basic Ajax Routine (get & post)
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxroutine.htm
3) Describe problem:
I'm successfully calling a perl script using post method. So far so good.
I'm not a javascript programmer and using sample, the result is displayed using an alert command/box.
Knowing I have defined a div section with id=postresult, how do you replace the javascript alert command with another one to put myajax.responseText in postresult.
I tested
document.getElementById(mercimsg).innerHTML=myajax.responseText and many other thing ....
Going further: how do you test the first word in myajax.responseText is "Error" so you can display the response in an alert box (as it does now) otherwise display it in div
Sorry for asking something so very basic.
Thanks in advance
Lee
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxroutine.htm
3) Describe problem:
I'm successfully calling a perl script using post method. So far so good.
I'm not a javascript programmer and using sample, the result is displayed using an alert command/box.
Knowing I have defined a div section with id=postresult, how do you replace the javascript alert command with another one to put myajax.responseText in postresult.
I tested
document.getElementById(mercimsg).innerHTML=myajax.responseText and many other thing ....
Going further: how do you test the first word in myajax.responseText is "Error" so you can display the response in an alert box (as it does now) otherwise display it in div
Sorry for asking something so very basic.
Thanks in advance
Lee