基本上如果有這個工作。它打開查詢對話框爲什麼這個JavaScript事件沒有被觸發?
$("#opener").click(function() {
$.ajax({
url: "hello.php",
success: function(data) {
$("#dialog").html(data).dialog("open");
}
});
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 400,
width: 400,
modal: true
});
});
我想從
onClick="callMyFuncion(withDetails);
調用它,並且基本上與myDetails發送AJAX GET請求..繼承人我嘗試
function getDayDetails(details) {
$.ajax({
type: "GET",
data: details,
url: "hello.php",
success: function(data) {
$("#dialog").html(data).dialog("open");
}
});
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 400,
width: 400,
modal: true
});
};
並從此處致電
<td class="everyday" onClick="getDayDetails(monthID=<?php echo $month; ?>&dayID=<?php echo $day_num; ?>&yearID=<?php echo $year; ?>);">
我是新來的Javascript/jQuery的..感謝所有幫助
呃!我建議你在代表團使用'on',更清潔,更明顯。 – elclanrs
你原來的方式比你的第二種方式要好得多。 –
@elclanrs OP提到他是JavaScript和jquery的新手。他可能不知道'開'。不需要對此有任何態度;人們應該感到舒適的問問題:)這就是說,我完全同意'on'是更好的方法。 [相關文檔在這裏](http://api.jquery.com/on/)。 – benekastah