views:

37

answers:

1

I get an asyc response from the server that contains an HTML that I would like to display:

    $( document ).ready( function ()
    {
       var options = 
       {
        success: showResponse,
        error: errorHandler,
        type: 'post'
       }; 

       // bind to the form's submit event 
       $('#captureForm').submit(function() 
       {
           $(this).ajaxSubmit(options); 
           return false; 
       });
   });

   function showResponse(responseDoc, statusText)
   {
       $('#output').html( responseDoc );
   }

Where #output is a div where I would like the response document to be injected. The above code does not do the trick.

Any suggestions will be greatly appreciated.

Thanks.

-Raj

A: 

it might be a problem with options, try moving them into the function.

Aaron Harun
Aaron,Thanks for the response. I can see showResponse() being called with an XML DOM object, so the form submission part is OK. The question really is, how do I inject (or append) this DOM into the div called output
Does the #output div exist and is there a response? Are you returning XML instead of HTML?
Aaron Harun
I have <div id="output"></div>. The response content type is XML since I am returning a <div> as the root element from the server.