阿贾克斯求婚,但没有任何反应

时间:2018-11-22 12:18:13

标签: javascript java ajax post submit

我有这个脚本,但是什么也没有发生,有人可以告诉我哪里错了吗?我想建立一个聊天室,但是什么也没有发生,当我按下按钮堆栈时,有人可以告诉我哪里错了,给我一个我应该怎么做?还是有人给我一个细节,请原谅我这么长的帖子,但是在这里我不能写太多细节,谢谢你

<?
//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 个答案:

没有答案