I have a little problem, because I don't know how to insert a LifeRay message to the JavaScript CONTENT. It works very nice, but only when text is provided. I want to view the UI message in another div which was previously generated by Liferay with id=p_86. I simply have to put tag liferay-ui:success into above div. This event is related to data saving. It works good but the message is displayed in the wrong place so I want to move it to div with id=p_68.
<liferay-ui:success key="klucz" message="
<%=PortletUtils.getInfoMessage(renderRequest) %>"/>
<liferay-ui:error key="cap_global_msg_error_key" message="
<%=PortletUtils.getErrorMessage(renderRequest) %>"/>
<script type="text/javascript">
$("#p_86").append("<div id='newid'> CONTENT </div>");
</script>