Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Newbie ... passing a value to document.write in doc body

    I almost never use javascript, so sorry for my attempts to describe this.

    I'm trying out a very simple ajax form (AJFORM). It's so simple that it outputs the results as an Alert. I'd like to take the values passed back and document.write them into my page "normally" instead of using an alert.

    Header code looks like:
    Code:
    			function getReturnData( data , statusCode , statusMessage) {
    			 	//AJFORM failed. Submit form normally.
    			 	if( statusCode != AJForm.STATUS['SUCCESS'] ) {
    
    				 return true;
    			 	}
    			 	//AJFORM succeeded.
    			 	else {
    				 alert( "Data:\n" + data );
    			 	}
    			}
    			
    
    			function goForm(whichForm) {
    			 thisForm = document.getElementById( whichForm );
    			 // thisForm.submit() will not work using AJFORM. Instead, you need to use the following:
    			 thisForm.ajform_submit();
    			}

    Basically, I want to take the contents of the variable "data" and write it to the document, not in the headers where the functions are, but further down, right after the HTML form. I have some vague idea of how I could do this if I wanted to assign the value of "data" to a textarea or some other form element. But I can't figure out how to simply write it to the page further down with a document.write().

    I know I probably didn't put this very clearly, so I'd be glad to try again.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,243
    Thanks
    203
    Thanked 2,555 Times in 2,533 Posts
    "I have some vague idea of how I could do this if I wanted to assign the value of "data" to a textarea or some other form element. But I can't figure out how to simply write it to the page further down with a document.write()."

    Calling the document.write() method at runtime will cause the specified content to be written into a new blank document thus replacing the current page.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •