Uncaught ReferenceError: Ajax is not defined

时间:2022-04-25 19:57:14

I got an error in my mybb forum. I used a plugins for advance stats. But i got an error in console about "Uncaught ReferenceError: Ajax is not defined" So that's why my website not loading latest post from top.

我的mybb论坛出错了。我使用插件进行高级统计。但我在控制台中遇到一个错误“未捕获的ReferenceError:Ajax未定义”这就是为什么我的网站没有从顶部加载最新的帖子。

Website: http://satfriends.net/index.php

Here is my code

这是我的代码

<!-- start: changuondyu_stats_script -->
	<script language="JavaScript" type="text/javascript">
		var fcmenu;
var listtab = new Array();
listtab[0] = "allforum";
listtab[1] = "inforum&listforumid=8";
listtab[2] = "inforum&listforumid=21,15,7";
listtab[3] = "inforum&listforumid=14";


function cswitch(taborder)
{
fcmenu = listtab[taborder];
document.getElementById('ct'+taborder).className = 'thead';
for (i = 0; i <= 3; i++)
{
 if (i != taborder)
   {
    document.getElementById('ct'+i).className = 'tcat';
   }
}
changstats_post();
}

function hshowpost(request)
{
  if (request.readyState == 4 && request.status == 200)
	{
	document.getElementById('chang_latestposts').innerHTML = request.responseText;
	document.getElementById('cprogress_post').style.display="none";
	}
}
function hshowtop_user(request)
{
  if (request.readyState == 4 && request.status == 200)
	{
	document.getElementById('chang_top_user').innerHTML = request.responseText;
	document.getElementById('cprogress_top').style.display="none";
	}
}
function hshowtop_forum(request)
{
  if (request.readyState == 4 && request.status == 200)
	{
	document.getElementById('chang_top_forum').innerHTML = request.responseText;
	document.getElementById('cprogress_top').style.display="none";
	}
}


function changstats_post()
{
	document.getElementById('cprogress_post').style.display="inline";
	fcresult = document.getmenu.choosekq.value;
	new Ajax.Request('xmlhttp.php?do='+fcmenu+'&result='+fcresult, {method: 'GET', postBody: null, onComplete: function(request) { hshowpost(request); }});
}
function changstats_top_user()
{
	document.getElementById('cprogress_top').style.display="inline";
	fcmenu_top_user = document.getmenu.choosetop_user.value;
	fcresult = document.getmenu.choosekq.value;
	new Ajax.Request('xmlhttp.php?do='+fcmenu_top_user+'&result='+fcresult, {method: 'GET', postBody: null, onComplete: function(request) { hshowtop_user(request); }});
}
function changstats_top_forum()
{
	document.getElementById('cprogress_top').style.display="inline";
	fcmenu_top_forum = document.getmenu.choosetop_forum.value;
	fcresult = document.getmenu.choosekq.value;
	new Ajax.Request('xmlhttp.php?do='+fcmenu_top_forum+'&result='+fcresult, {method: 'GET', postBody: null, onComplete: function(request) { hshowtop_forum(request); }});
}

cswitch(0);
changstats_top_user();
changstats_top_forum();


</script>
<!-- end: changuondyu_stats_script -->

Give e a solution for that, how can i fix it.

为此提供解决方案,我该如何解决它。

Thanks

1 个解决方案

#1


2  

You have to include the reference to the api where the method Ajax.Request is included. In your case it seems that is Prototype library.

您必须包含对包含方法Ajax.Request的api的引用。在你的情况下,它似乎是原型库。

Include the library at the top of your html page:

将库包含在html页面的顶部:

<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.3.0/prototype.js"></script>

#1


2  

You have to include the reference to the api where the method Ajax.Request is included. In your case it seems that is Prototype library.

您必须包含对包含方法Ajax.Request的api的引用。在你的情况下,它似乎是原型库。

Include the library at the top of your html page:

将库包含在html页面的顶部:

<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.3.0/prototype.js"></script>