我正在创建活动日历。它在我们的Intranet上运行良好,但当我将插件复制到外部站点时,我不断得到以下信息:
对不起,那没用。请再试一次或稍后再来。500错误。内部服务器错误。
以下是调用函数的代码:
<button id="prev" class="button" onclick="getPrevmonth()"> < </button>
下面是Javascript/AJAX函数:(我使用了几个警报来确保它正常运行,而且似乎是这样的)
function getPrevmonth() {
var currentmonth = document.getElementById(\'currentmonth\').value;
var currentyear = document.getElementById(\'currentyear\').value;
if (currentmonth) {
if (currentmonth == 0) {
var newmonth = 11;
var newyear = currentyear-1;
} else {
var newmonth = Number(currentmonth) - 1;
var newyear = currentyear;
}
alert("month set =" + newmonth);
} else {
var date = new Date();
var month = date.getMonth();
var year = date.getFullYear();
if (month == 0) {
var newmonth = 11;
var newyear = year-1;
} else {
var newmonth = month - 1;
var newyear = year;
}
}
( function( $ ) {
$.ajax({
type: "GET", // use $_GET method to submit data
url: CalendarScript.pluginsUrl + \'/events/processcalendar.php\', // where to submit the data
data: {
newmonth : newmonth, // PHP: $_GET[\'newmonth\']
newyear : newyear, // PHP: $_GET[\'newyear\']
},
success:function(data) {
$( \'#calendardiv\' ).html( data ); // add HTML results to empty div
$( \'#currentmonth\' ).val( newmonth );
$( \'#currentyear\' ).val( newyear );
},
error: function(req, textStatus, errorThrown){
//alert(\'Ooops, something happened: \' + textStatus + \' \' +errorThrown);
$( \'#calendardiv\' ).html( req.responseText );
}
});
} )( jQuery );
}
这是processcalendar。php。我删除了所有代码,只是加入了一些简单的东西来测试它是否在这段代码中,但它仍然显示上面的错误:
<?php
require_once(\'../../../wp-load.php\');
global $wpdb;
$newmonth = $_GET["newmonth"];
echo $newmonth;
感谢您的帮助或建议。提前谢谢。