2012-10-14 33 views
-1

你好是我的問題:jQuery的,載荷()點擊特定的按鈕時不起作用

我聊天,我想在數據庫中單擊一個按鈕後增加的消息。

繼承人代碼:

$('button[id="czat_pisz"]').bind('click',function() { 
     alert("Passes"); 
     $('#hidden').load("czat_pisanie.php?type=" + chat_type + "?message=" + text + "?nick=" + gracz_nick); 
    }); 

警報只是爲了檢查。當我點擊一個按鈕時顯示。但是load()不起作用。當我將它從點擊功能中解放出來的時候它就起作用

如何解決?

+0

您有大多數的服務器無效的網址。你不應該有多個「?」。我希望你的參數值已經被編碼了...... –

+0

你在控制檯中看到了什麼? – SLaks

回答

0

對不起,誤會

$('#hidden').load("czat_pisanie.php?type=" + chat_type + "?message=" + text + "?nick=" + gracz_nick); 

這裏是probelem

應該

$('#hidden').load("czat_pisanie.php?type="+chat_type+"&message="+text +"&nick="+ gracz_nick); 

根據您的評論

$('button[id="czat_pisz"]').bind('click',function() { > $('#hidden').load("test.html"); }); 
      here is the problem ---------------------^----remove this stray > 
+1

該加載不是加載事件。 http://api.jquery.com/load/ – undefined

+0

@undefined對不起,我錯了,load()函數是deprecatedso所以我想OP被談論的負載 –

+0

@NullPointer負載事件不會deprecateed的'負荷()' – StaticVariable

1

您有無效的URL

$('#hidden').load("czat_pisanie.php?type=" + chat_type + "?message=" + text + "?nick=" + gracz_nick); 

使用本

$('#hidden').load("czat_pisanie.php?type=" + chat_type + "&message=" + text + "&nick=" + gracz_nick); 
+2

否; 'load()'不被棄用。 – SLaks

+0

'load'事件被棄用而不是'load'。 http://api.jquery.com/load-event/ – undefined

+0

@undefined thanx for update.see編輯答案 – StaticVariable