PHP头条
热点:

实现效果:

2、点击发送时的ajax代码:


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

<script>

 $(".tc").click(function(){

  $("#kuangjia").show(); 

 })

  $(".fasong").click(function(){

  var nr=$("#words").val();

  $.ajax({

   url:"qt-speak-cl.php",

   data:{words:nr},

   type:"POST",

   dataType:"TEXT",

   success: function(data){

    if(data==1)

    {

    window.location.href="qt-dh.php" rel="external nofollow" rel="external nofollow" ;

    }

    else{

     alert("发送内容不能为空!");

    }

    }

  })

 })

  $("#dh").click(function(){

  $.ajax({

   url:"qt-yidu-cl.php",

   dataType:"TEXT",

   success: function(data){

//    alert(data);    

    window.location.href="qt-dh.php" rel="external nofollow" rel="external nofollow" ;   

   }  

  })

 })

</script>

 3、qt-speak-cl.php页面:


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

<?php

session_start();

require "DBDA.class.php";

$db = new DBDA();

$uid = $_SESSION["uid"];

$words =$_POST["words"];

$chtime=date("Y-m-d H:i:s",time());

$jieshou = "zhangsan";

if(!empty($words))

{

$sql="insert into duihua values ('','{$jieshou}','{$uid}','','{$words}',0,'{$chtime}')";

echo $db->query($sql,0);

<em id="__mceDel">}

else

{

 echo "发送内容不能为空!";

}

?>

</em>

 如果发送内容为空,则会提示“发送内容不能为空!”

前台页面会随不同用户登录显示不同的信息;让王五登录看看:

以上所述是小编给大家介绍的PHP+Mysql+Ajax实现淘宝客服或阿里旺旺聊天功能(前台页面),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

原文链接:http://www.cnblogs.com/chenguanai/p/7018835.html

www.phpzy.comtrue/php/27913.htmlTechArticle实现效果: 2、点击发送时的ajax代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 script $( .tc ).click( function (){ $( #kuangjia ).show();...

相关文章

    暂无相关文章

PHP之友评论

今天推荐