更新时间:2023-11-29 23:29:22
函数showMessage(TXT,类型){
VAR HTML ='< UL类=消息><李类=+类型+' - 味精>< UL><李> + TXT +'< /李>< / UL>< /李>< / UL>';
$('消息'),更新(HTML)。
}
在键入的可能是'错误','成功',通知或警告。尽情享受吧!
I can add error/success message to the Magento admin panel from server-side, for example,
Mage::getSingleton(’core/session’)->addError('***');
But how to show the same message on the client-side using JS? I mean standard way (of course I can create the same message box, but it's not a solution). For example when I need to show a status of some AJAX request. Any ideas?
function showMessage(txt, type) {
var html = '<ul class="messages"><li class="'+type+'-msg"><ul><li>' + txt + '</li></ul></li></ul>';
$('messages').update(html);
}
The type could be 'error', 'success', 'notice' or 'warning'. Enjoy!