$.ajax not returning data
Currently, I'm building a website with jQuery. The function below helps me to get content from a database. In the file content_ajax.php there are some functions to handle ajax-requests. JS calls the PHP-function correctly (I've send an email to myself inside that function to check) but the script doesn't return 'succes' and doesn't give me an error...Also, when I put an alert inside the succes and error function, it doesn't popup!
Does anybody know what causes this problem?
What may be relevant:
- site uses mod_rewrite for friendly url's
-
//JAVASCRIPT (CONTENT.JS
function loadContent(DIVID,CID){
$.ajax(
{
type: "get",
url: "modules/content/content_ajax.php",
data: "ajax_action=loadContent&id="+CID,
succes: function (data){
$('#'+DIVID).html(data);
},
error:function (xhr, ajaxOptions, thrownError){
$('#'+DIVID).html('<B>Helaas, er is een fout opgetreden!</B><br /><br /><hr>'+xhr.responseText + ' (ID:'+CID+')');
}
}
);
}
//PHP (CONTENT_AJAX.PHP)
<?php
require_once '../../base.php';
require_once 'content_class.php';
$content = new content;
if(isset($_GET['ajax_action'])){
switch($_GET['ajax_action']){
case 'loadContent':
$content->loadContent($_GET['id']);
break;
}
exit();
}
?>