首先感謝您檢查我的問題,併爲您提供任何幫助!使用JQuery Ajax調用一個PHP函數
好吧,就像標題所示,我需要從我的索引頁調用php函數,該函數使用JQuery Ajax在我的數據庫中添加了一條新的記錄。此函數將返回一個整數,然後將打印在從中調用它的表單按鈕中。
任何人有一個想法,我會如何做到這一點?任何指導表示讚賞!
Edit:
So if I'm using a template object I can just call the
function using ajax and it will return the output?
What would I use as the URL? index.php?
Such as...
function DoVote() {
$.ajax({
type:'POST',
url: 'index.php',
success: function(data) {
$('#voteText').html(data);
}
});
而表單動作屬性張貼我猜?
或者我怎樣才能使用Ajax調用php函數? – NickKampe 2010-05-16 06:29:17