douhang1913
2013-11-16 18:41
浏览 40

Jquery / Ajax发布变量

i need help with a script, i dont know what is wrong but i think its here:

$.post("chatSend.php", {text: text, nome: nome,},

but i dont know how to fix it.

Full code:

  //Script para enviar e fazer descer a barra quand submited
 $(function(){
 var keyStop = {
   8: ":not(input:text, textarea, input:file, input:password)", // stop backspace = back
   13: "input:text, input:password", // stop enter = submit 

   end: null
 };
 $(document).bind("keydown", function(event){
  var selector = keyStop[event.which];

  if(selector !== undefined && $(event.target).is(selector)) {
  var text = $("#text");
  var nome = $("#nome");
        var text = text.val(); 
        var nome = nome.val();

        $.post("chatSend.php", {text: text, nome: nome,},

        function(data){
         $('#chat').load('getChat.php');
         $('#chat').animate({scrollTop: '30000px'}, 1000);
         $("input[type='text']").val('');
         }
         , "html");
      event.preventDefault(); //stop event
  }
  return true;
 });
});

Thanks!!!

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douzheng1853 2013-11-16 18:44
    已采纳

    use $.post("chatSend.php", {text: text, nome: nome}, instead of $.post("chatSend.php", {text: text, nome: nome,},

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题