do NOT use document.write() AFTER the current document is fully loaded. since .ready(handler) specifies a function to execute when the DOM is fully loaded, using of document.write() destroys everything.
use the appropriate syntax. jquery's slogan is 'write less, do more', so follow this idea when composing the code.
incorrect var name = document.getElementById("text");
correct var name = $("#text").val();
p.s. and plz read my signature