3
現在確實沒有詢問此查詢,最後我放棄了因爲我無法找到可查詢的可切換答案。
在我的apache2服務器上,我已經在根目錄下的.htaccess文件中啓用重寫規則,以持久地保持指向一切,但目錄和文件到一個特定的PHP文件,這完美的作品,但問題的AJAX腳本失敗時, 。當url目錄發生變化時,Ajax不發送請求到php
這裏是PHP腳本[測試...]
<?php
//now if run the test using the root directory, i get clear response,
//but as i have told u, i have enabled apache2 module and added rewrite rules to .htaccess,
//meaning that no matter hat the url is, the url will keep pointing to the same file but the problem
// is that the ajax script does not fire p the request/send.
//i dont jnow what i am doing wrong...
if(isset($_GET['test_changes'])){
echo 'the request has now reached the server';
exit;
}
?>
這裏是AJAX腳本
<script>
//my ajax script is like this
//the url seen below is in the root directory.
//So briefly,how would i keep this url pointing to the same php file even if the directory changes
$.ajax({
url:'test.php?test_changes=123456789',
cache:false,
async:true,
method:'GET',
success:function(response){
console.log(response)
},
error:function(error){
console.log(error)
}
})
</script>
我總是忘記,這是真的有關,謝謝... – Zuckerberg