Thiết kế bố trí đoạn hội thoại
Code ajax
JAVASCRIPT
<script type="text/javascript" src="http://wap.mu/files/1025588/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#post_msg').submit(function(){ var that=$(this); var action=that.attr('action'); var text=that.find('textarea').val(); var len=text.length; if(len==0){alert('Vui lòng nhập văn bản');}else{ $.post(action,{msg: text},function(data,status){ if(status=='success'){ $('#chat_txt').val(''); message(); }; });}; return false; }); function message(){ $.ajax({type:"GET",url:location.href,success:function(msg_txt){ list_msg=$(msg_txt).find('.list_msg').html(); $('.list_msg').html(list_msg); }}); setTimeout(function(){message()},1000)}; message(); });</script>
Cách cài: tìm <form thay thành <form id="post_msg"
Tìm {{message_list}} thay thành <div class="list_msg">{{message_list}}</div>
Code không hoạt động vui lòng để lại ý kiến vui lòng cmt tại đây!
Nguồn b0ysh0ck_hn
![[OFF]](/assets/images/off.gif)