Posted By:
murali_sappa
Posted On:
Friday, September 15, 2006 06:45 PM
Yes, it is possible - however, not as you specified. If you have the following string -
abcd efgh ijkl
and you want to replace "efgh" by "somethingelse" and if you have a javascript variable global/local that is defined as -
var efgh="somethingelse";
Then, you need to to return the following string from your server -
"abcd "+efgh+" ijkl"
And, set your innerHTML with eval(stringreturned)
Basically, you are forcing the browser to expand the javascript variables since that can't be done on the sever side. This option is will have a variety of side effects :) so, unless you really need to go this route, don't do it.
Few other options would be to parse the returned data and modify before setting the innerHTML, use regular expressions, or use defer tag and return the data as javascript. Hope this information helps, please let us know what you find.
Regards,
-Murali