[jQuery] Replace <=> ajax problem.

[jQuery] Replace <=> ajax problem.


Hello I got a problem. I use a blockui plugin, and I want to use a
form on it. When click ok button, the ajax upload datas to server,
server check the form is valid, and if it not, the return html code
contain that class: error-msg. I can find this class, but my problem
in redraw the form.
$('#btn-ok').click(function() {
var sendData='mod=2';
// update the block message
$.blockUI("<h1>Remote call in progress...</h1>");
$.ajax({
             data: sendData,
             complete: function(html) {
                    var response_html_text = html.responseText;
                    // get the result contain the error-msg class(my function, it is
works)
                    if (hasClassRec(response_html_text, 'error-msg')) {
                        // THIS CODE NOT WORKING! THE OLD CODE IN THE question, NOT THE
NEW HTML!
                        $(question).replaceWith( response_html_text );
                         $.blockUI(question, { width: '275px' });
                    }
                    else {
                        window.location = "generate_function";
                        $.unblockUI();
                    }
             }
             });
return false;
});
Thanks for you