Please regard this CP article:
Calling WCF Services using jQuery[
^]
It uses jQuery, but should be easily adaptable to use other javascript libraries as well. There are a bunch of mature cross browser compatible javascript libraries out there so my advice is not to do AJAX in the way you outlined. Use PrototypeJS or jQuery instead.
Best Regards,
Manfred