我創建了一個Web應用程序,基本思想是有一個頁面,然後用ajax插入來自php-mysql腳本的數據。在本地Xampp上,應用程序完美運行。jQuery-Ajax不工作在生產服務器上
在生產服務器上一些Ajax請求工作,但其他人不工作。
鉻檢查元素顯示錯誤:
POST mysite.com/app/show_staff_profile_ajax.php 500 (Internal Server Error) jquery-2.0.3.js:7845
send jquery-2.0.3.js:7845
jQuery.extend.ajax jquery-2.0.3.js:7301
showProfile ajax.js:466
(anonymous function) ajax.js:150
jQuery.event.dispatch jquery-2.0.3.js:4676
elemData.handle jquery-2.0.3.js:4360
在ajax.js線150我得到:
$(document).on('click','.show_profile',function(){
var id = $(this).attr("id");
showProfile(id); //line 150
return false;
});
並在線路446:
function showProfile(id){
$.ajax({ //line 446
type:"POST",
url: "show_staff_profile_ajax.php",
data: {id : id},
success: function(data)
{
$("#program_panel").html(data);
}
});
}
在show_staff_profile_ajax.php我我正從mysql取數據並且echo:帶有php變量的html標籤。
我想了兩天解決這個問題。我讀了很多帖子,但似乎沒有任何工作
通常,由於服務器端的某些問題而發生500個錯誤。也。檢查具有'.show_profile'的節點是否具有ID屬性。 – karthikr
嘗試在服務器本身的瀏覽器中發佈數據,以便看到實際的錯誤,因爲500錯誤意味着「出錯了」。如果你在服務器上運行它,它會給你更多的信息。 – Archer
這很奇怪...我做了一個小提琴和它的工作.. http://jsfiddle.net/robertrozas/mw2rt/ – Hackerman