我對Jquery來說很新,需要幫助,試圖讓一些事件在同一頁面上運行。我有兩個部分的事件,一個是.get,它將數據傳遞給文件,然後顯示檢索到的數據,這發生在頁面加載。第二部分是點擊單擊按鈕時發送和接收數據的點擊事件。在一個頁面上的多個Jquery事件
這些事件都可以根據需要進行工作,但是如果我在一個頁面上有兩個部分,點擊事件就不起作用。下面是我有的代碼,我希望有人知道如何讓他們全部工作?由於
<script type="text/javascript">
$.get("/layout/standard/check.php", { url: "domain"}, function(data){
$("#content-area").html(data)
});
$(".discuss").click(function() {
$.post('/layout/standard/report-action.php', {form: "discuss"},function(data){
$(".message").html(data);
$(".message").show("slow");
});
});
$(".request").click(function() {
$.post('/layout/standard/report-action.php', {form: "request"},function(data){
$(".message").html(data);
$(".message").show("slow");
});
});
$(".report").click(function() {
$.post('/layout/standard/report-action.php', {form: "report"},function(data){
$(".message").html(data);
$(".message").show("slow");
});
});
</script>
我相信我已經找到了,爲什麼它不工作,的onclick鏈接由GET事件放在頁面上。看起來,如果按鈕已經在頁面上,按鈕就可以工作,但如果按照這種方式插入按鈕則不會。
這沒有意義,我作爲按鈕仍然充當沒有問題鏈接...
你有沒有在控制檯中的任何錯誤裏面? –
我有一個控制檯錯誤,但我不知道它是否相關:未捕獲TypeError:對象[對象對象]沒有方法'on' – Paul
恐怕沒有工作。 – Paul