有哪位能告诉我这是什么情况啊

来源:4-7 实现自动回复功能(下)

噜啦_0

2017-03-18 15:52

http://img.mukewang.com/58cce68b0001878d03380472.jpg

不管输什么,我的对话框里都是输出的一段奇怪的代码??

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title>微信公众号</title>
 <!--讨论区滚动条begin-->
 <link rel="stylesheet" type="text/css" href="<%= basePath %>resources/css/jscrollpane1.css" />
 <script src="<%= basePath %>resources/js/common/jquery-1.8.0.min.js" type="text/javascript"></script>
 <!-- the mousewheel plugin -->
 <script type="text/javascript" src="<%= basePath %>resources/js/common/jquery.mousewheel.js"></script>
 <!-- the jScrollPane script -->
 <script type="text/javascript" src="<%= basePath %>resources/js/common/jquery.jscrollpane.min.js"></script>
 <script type="text/javascript" src="<%= basePath %>resources/js/common/scroll-startstop.events.jquery.js"></script>
 <!--讨论区滚动条end-->
 <script type="text/javascript" src="<%= basePath%>resources/js/front/communicate.js"></script>
 </head>
 <body>
  <input type="hidden" value="<%= basePath %>" id="basePath"/>
  <br/>
  <div class="talk">
   <div class="talk_title"><span>正在与公众号对话</span></div>
   <div class="talk_record">
    <div id="jp-container" class="jp-container">
     
    </div>
   </div>
   
   <div class="talk_word">
    &nbsp;
    <input class="add_face" id="facial" type="button" title="添加表情" value="" />
    <input id="content" class="messages emotion"   />
    <input class="talk_send" onclick="send();" type="button" title="发送" value="发送" />
   </div>
  </div>
  <div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';"></div>
 </body>
</html>

JavaScript

send方法

/**
 * send message
 * @returns
 */
function send(){
 var content = $("#content").val;
 if(!content){
  alert("input context.");
  return;
 }
 $.ajax({
  url:$("#basePath").val()+"AutoReplyServlet.action",
  type:"POST",
  dataType:"text",
  timeout:1000,
  success:function(data){
   appendDialog("talk_recordboxme","MyAccount",content);
   appendDialog("talk_recordbox","OfficialAccount",data);
   $("#content").val("");
   render();
  },
  data:{"content":content}
 });
}


写回答 关注

2回答

  • 噜啦_0
    2017-03-18 16:14:30

    但是还有一个问题就是,为什么我写的明明是小写,为什么输出的全变成大写了????


  • 噜啦_0
    2017-03-18 16:01:04

    好吧,我真傻真的,send里的var content = $("#content").val;最后因该是val();

通过自动回复机器人学Mybatis---基础版

微信公众号自动回复功能学习Mybatis,基础教程加案例实战方式学习

107413 学习 · 831 问题

查看课程

相似问题