George_Fal 2018-11-22 12:18 采纳率: 0%
浏览 21

Ajax sumit,但是什么也没发生

I have this script but nothing happen,can someone tell me what is wrong?i want to make a chat room but nothing is happen,when i press the button is stack,can someone tell me what is wrong and give me a detail about what should i do?Or someone give me another detail,please excuse me about this long post but here i cant write less details,thank you in advance

<?
//include("write_chat.php");
$rid = $_GET["rid"];


echo "<div id='postResults'></div>";

?>


<script>

//inregistrare postare
$('body').on('submit', '#contact-form', function(){
  $.post('index.php?page=writechat&rid=".$_GET["rid"].", $(this).serialize(), function(resp){
    alert(resp);
  });
  return false;
});

//afisare la interval de timp
setInterval(function(){
  $('#content').load(index.php?page=writechat&rid=".$_GET["rid"]');
}, 5000);







  (function($)
  {
      $(document).ready(function()
      {
          $.ajaxSetup(
          {
              cache: false,
              beforeSend: function() {
                  $('#content').hide();
                  $('#loading').show();
              },
              complete: function() {
                  $('#loading').hide();
                  $('#content').show();
              },
              success: function() {
                  $('#loading').hide();
                  $('#content').show();
              }
          });
          var $container = $("#content");
          $container.load("<?php echo "index.php?page=writechat&rid=".$_GET["rid"].""; ?>");
          var refreshId = setInterval(function()
          {
              $container.load('<?php echo "index.php?page=writechat&rid=".$_GET["rid"].""; ?>');
          }, 5000);
      });
  })(jQuery);


</script>


<body>
<div id ="content"></div>

<form  id="contact-form" class="bl_form text-center" action="<?php echo "../../index.php?page=writechat&rid=$rid"; ?>" method="post" novalidate>
  <span class="field-wrap scrollimation fade-
    right">
  </span>
  <span 
    class="field-wrap scrollimation fade-left">
  <textarea id="contact-message" 
    name="message" rows="5" class="label_better requiredField" data-new-
    placeholder="Message"  style="margin: 0px; width: 1210px; 
    height: 88px;" data-error-empty="<?php echo "$insert_message"; ?>"></textarea>
  </span>
  <p class="text-center"><button  name="sy2" 
    id="submit_post" type="submit"  class="btn btn-sm btn-primary icon-left" data-error-
    message="Error!" data-sending-message="Sending..." data-ok-message="Message Sent"><i 
    class="fa fa-paper-plane"></i>Send Message</button></p>
  <input type="hidden" name="submitted" 
    id="submitted" value="true" />
  <?php echo "<postfield name=\"message\" 
    value=\"$(message)\"/>"; ?>
</form>
</body>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制