MyBB Community Forums

Full Version: Uncaught ReferenceError
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, everyone.

I have a custom theme, but every time I make a new post in a thread I get this error, and the more replies the more it stacks up with the error.

Uncaught ReferenceError: use_xmlhttprequest is not defined(anonymous function) @ showthread.php?tid=2&pid=8:598

showthread.php?tid=2&pid=8:712 Uncaught ReferenceError: use_xmlhttprequest is not defined(anonymous function) @ showthread.php?tid=2&pid=8:712

I don't get this error with the default theme so I know it's a problem with my theme, what can cause this problem?

Here is my showthread Template

<html>
<head>
<title>{$thread['subject']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
	var quickdelete_confirm = "{$lang->quickdelete_confirm}";
	var quickrestore_confirm = "{$lang->quickrestore_confirm}";
	var allowEditReason = "{$mybb->settings['alloweditreason']}";
	lang.save_changes = "{$lang->save_changes}";
	lang.cancel_edit = "{$lang->cancel_edit}";
	lang.quick_edit_update_error = "{$lang->quick_edit_update_error}";
	lang.quick_reply_post_error = "{$lang->quick_reply_post_error}";
	lang.quick_delete_error = "{$lang->quick_delete_error}";
	lang.quick_delete_success = "{$lang->quick_delete_success}";
	lang.quick_delete_thread_success = "{$lang->quick_delete_thread_success}";
	lang.quick_restore_error = "{$lang->quick_restore_error}";
	lang.quick_restore_success = "{$lang->quick_restore_success}";
	lang.editreason = "{$lang->postbit_editreason}";
// -->
</script>
<!-- jeditable (jquery) -->
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/report.js?ver=1804"></script>
<script src="{$mybb->asset_url}/jscripts/jeditable/jeditable.min.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/thread.js?ver=1804"></script>
</head>
<body>
	{$header}
	{$threadnotesbox}
	{$pollbox}
	<div class="float_left">
		{$multipage}
	</div>
	<div class="float_right">
		{$newreply}
	</div>
	{$ratethread}
	<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder tfixed clear">
		<tr>
			<td class="thead">
				<div class="float_right">
					<span class="smalltext"><strong><a href="javascript:;" id="thread_modes">{$lang->thread_modes}</a>{$threadnoteslink}</strong></span>
				</div>
				<div>
					<strong>{$thread['threadprefix']}{$thread['subject']}</strong>
				</div>
			</td>
		</tr>
<tr><td id="posts_container">
	<div id="posts">
    {$posts} 
	</div>
</td></tr>
		<tr>
			<td class="tfoot">
				
			</td>
		</tr>
	</table>
	<div class="float_left">
		{$multipage}
	</div>
	{$quickreply}
	{$threadexbox}
	{$similarthreads}
	<br />
	

	<div class="float_right" style="text-align: right;">
		{$moderationoptions}
	
	</div>
	<br class="clear" />
	{$footer}<br>
	<div id="thread_modes_popup" class="popup_menu" style="display: none;"><div class="popup_item_container"><a href="showthread.php?mode=linear&amp;tid={$tid}&amp;pid={$pid}#pid{$pid}" class="popup_item">{$lang->linear}</a></div><div class="popup_item_container"><a href="showthread.php?mode=threaded&amp;tid={$tid}&amp;pid={$pid}#pid{$pid}" class="popup_item">{$lang->threaded}</a></div></div>
	<script type="text/javascript">
	// <!--
		if(use_xmlhttprequest == "1")
		{
			$("#thread_modes").popupMenu();
		}
	// -->
	</script>
	
	<script type="text/javascript">
		$(".author_avatar img").error(function () {
			$(this).unbind("error").closest('.author_avatar').remove();
		});
	</script>
</body>
</html>
which theme do you have? can you provide your forum URL? ...
(2016-01-30, 08:04 PM)Blackbeard Wrote: [ -> ]which theme do you have? can you provide your forum URL? ...

It's made from scratch, and currently I am running it localhost.

Removing:

<script type="text/javascript">
// <!--
if(use_xmlhttprequest == "1")
{
$("#edit_post_{$post['pid']}").popupMenu();
}
// -->
</script>

From my postbit_edit fixes these errors. What is the JS used for?
the popupMenu from edit post (quick edit and full edit)? check if it's working...
No, when I click the button it goes straight to Full Edit and doesn't give me the option to choose Quick Edit.

I have fixed it. If anyone else is getting this error it is because you are missing

var my_post_key = "{$mybb->post_code}";

From your HEADERINCLUDE tempalte.