Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught ReferenceError: Ajax is not defined

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.

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

like image 209
jone hans Avatar asked Sep 21 '26 05:09

jone hans


1 Answers

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.

Include the library at the top of your html page:

<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.3.0/prototype.js"></script>
like image 159
anmarti Avatar answered Sep 23 '26 20:09

anmarti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!