我在模块文件中调用post ajax数据时遇到问题。
这是我的js代码:
$.ajax({
type: "POST",
dataType: 'json',
cache: false,
url: Drupal.settings.basePath'netmemberdirectory/ajax',
data: "netmemberdirectory_table_ajax=", attrs,
success: function (data_in) {
alert(data_in);
displayTable(data_in, count, attrs);
},
error: function (jqXHR, textStatus, errorThrown) {
errorVal = textStatus;
}
});
这是我的.module代码:
if($_POST['netmemberdirectory_table_ajax']){
$attrs = drupal_json_decode($_POST['netmemberdirectory_table_ajax']);
echo "dddddd";die;
module_load_include('inc', 'netmemberdirectory','SoapAndDBUtils');
echo addcslashes(drupal_json_encode
(\NetMemberDirectory\SoapAndDBUtils::getRecords($attrs)), "'");
}else{
echo json_encode('error');
}
请帮忙