received: function(data) {
$("#notifications").prepend(data.html);
}
如何用原生js写出jquery的功能:
先创建<div>节点,然后附加到需求元素的内部,然后改变这个<div>的innerHTML。
var p = document.createElement('div')
document.getElementById("notifications").appendChild(p)
document.getElementById("notifications").lastChild.innerHTML = data.html