Kamran Ali
Kamran Ali

Reputation: 5954

Unable to render Strsuts2-jQuery Plugin Ajax response into HTML

I'am Strust2-Jquery Plugin in my application. Everything is running fine so far till i stuck into this issue. I 'm using sj:a tag to submit a from to the server, in case of error the server returns a html formatted error that i display to the user. I'm using the following code (a simplified version)

$.subscribeeventHandler' , function(event, data){

    var $res = $(event.originalEvent.request.responseText);
    alert(event.originalEvent.request.responseText);
    $('#recoverPasswordErrorMsg').html($res.html());

});

In the alert it displays the correct html but when i set the html it displays the html string rather parsing and displaying it. the following string is displayed on the page

"<strong>Your account is currently inactive. Please activate your account by clicking the link sent to [email protected] </strong>"

Upvotes: 1

Views: 212

Answers (1)

Kamran Ali
Kamran Ali

Reputation: 5954

I was using s:actionerro tag to display the message from the server side, basically this tag was escaping the HTMl as it has a property escape and its value is true by default. I changed the value of escape to false and it worked for me perfectly.

Upvotes: 1

Related Questions