I have set up a jquery script to submit a form and I want to grab the response (which I believe is a whole page, albiet small) and use the content of the response to replace the form (as the response is just the form).
here is my jquery script:
$("#addPersonButton").click(function(){
$.post("/MySite/MyAjaxServlet.do", $("#personForm").serialize(), function( data ) {
var content = $( data );
$( "#personForm" ).empty().append( content );
});
});
however the output on my page appears as “[object Object]”
How can I replace the form in my page with the form returned on the response?
Try,