所以,由於某種原因,我的腳本拒絕工作,但它似乎是正確的。
我嘗試使用$ .ajax來代替,但不能使用。任何想法出了什麼問題?
<script>
$(document).ready(function() {
$('#saveForm .submit').click(function() {
var _user = $('#saveForm .user');
_userId = $('#saveForm .userId');
_password = $('#saveForm .password');
$('#saveForm').append('<p>Loading...</p>');
$.post("ajax/fetchPhotos.php", {user:_user, userId:_userId, password:_password}, function(data) {
alert(data);
});
return false;
});
});
</script>
在AJAX/fetchPhotos.php我有這樣的:
<?php
set_time_limit(0);
session_start();
require_once("includes/functions.php");
require_once("includes/pclzip.lib.php");
/*
Huge block of code here (commented out for the moment)
*/
echo "wut?";
所以,點擊.submit的時候,它應該發送一個請求有三個PARAMS到fetchPhotos.php然後提醒 「武漢理工大學?」 。現在這個頁面掛在chrome中。沒有任何反應。在Firefox中,頁面只是刷新。我確實在控制檯中出現了一個錯誤,但我只是在頁面直接刷新時纔看到它。
感謝, 皮特
什麼是你的標記是什麼樣子? – 2010-12-03 13:43:25
在Firefox中,你看過`Error Console`嗎?這是在「工具」菜單中。除非您手動清除,否則`Error Console`內的信息不會消失。另外,如果您查看託管PHP腳本的Web服務器的日誌,您是否看到對腳本提出的任何請求?另外,Firefox上的HttpFox擴展可以幫助你跟蹤請求和響應。 – ayaz 2010-12-03 13:45:07