Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-04-2009, 01:20 PM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default I am trying to use ajax and getting this error message and do not understand Why

The following error is happening and I have some idea that the defining class for the ajax is missing and do not have any idea of how to include the class defination into my php file.

The error i am getting is this error:

Fatal error: Class 'vB_AJAX_Handler' not found in C:\Inetpub\vhosts\burningtaper.org\httpdocs\forums \calendar.php on line 131


At the line 131 number is the following line.

PHP Code:

PHP Code:

       My_AJAX_Object 
= new vB_AJAX_Handler(true); 
What could be missing ?


Here is all the setup code that i put in the top of my file calendar.php you can look at the other posting of mine to get more detail but I have include that part below.

PHP Code:

// ########################## AJAX RECIVER ############################

function My_AJAX_Reciever()
{
        if (
My_AJAX_Object.handler.readyState == && My_AJAX_Object.handler.status == 200 && My_AJAX_Object.handler.responseText)
        {
               
alert('Data recieved successfully\n\n' My_AJAX_Object.handler.responseText);
        }

}


// ########################## AJAX SETUP ############################

My_AJAX_Object = new vB_AJAX_Handler(true);


My_AJAX_Object.onreadystatechange(My_AJAX_Reciever);



// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ######################################################################## 
As you see I put the setup stuff before the START MAIN SCRIPT and I hope that is ok to do so?

In my guess it seems to me the error means that the ajax defination for the class is not tirned on or was never defined.

I really do not know at this level in the vbulletin product how this is done so things get even more complex when it is all kind new stuff for me.

I have read all the articals on ajax it was a help but it is not enough because - I do not know how to defne the class as the error sujgest above.

Can someone give me a example how this is done and how to fix things up so that at least when I make a call vB_AJAX_Handler(true) the thing does not error out first thing.

I also know that there is a need to allow for multi browser support in the class define but I can not understand that either. Please explain?

I have spent the last couple of days looking through the scripts my eyes hurt me.

Please explain me what is missing here and then I think I have the rest preity close I hope.


THANKS

Frank H. Shaw

PS I more details are needed all this: i have posted every thing i have done so far in my modifaction is also posted on a old thread at this url :

PHP Code:

       
[url]

                 
https://vborg.vbsupport.ru/showthread.php?p=1759693#post1759693

      
[/url
Reply With Quote
  #2  
Old 03-04-2009, 02:30 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

All you've done is copied what was in the tutorial without changing it for your specific needs. And what did you do regarding Step 3 in that tutorial to "Fire and Receive Data"?

You might want to also see this - https://vborg.vbsupport.ru/showthread.php?t=81626

(I don't 'do' ajax, so I can't really help with the specifics of your ajax problems.)
Reply With Quote
  #3  
Old 03-04-2009, 06:40 PM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
All you've done is copied what was in the tutorial without changing it for your specific needs. And what did you do regarding Step 3 in that tutorial to "Fire and Receive Data"?

You might want to also see this - https://vborg.vbsupport.ru/showthread.php?t=81626

(I don't 'do' ajax, so I can't really help with the specifics of your ajax problems.)
If you had click on the link you would see that I did deal with step 3 here is the link again


https://vborg.vbsupport.ru/showthrea...93#post1759693
Reply With Quote
  #4  
Old 03-05-2009, 05:00 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should not be using the (old) AJAX object. vBulletin now uses the YUI Javascript framework. You can fire a request with just:
Code:
YAHOO.util.Connect.asyncRequest('POST', scriptpath + '?do=ajax', {
	success: this.handle_ajax_response,
	failure: this.handle_ajax_error,
	timeout: vB_Default_Timeout,
	scope: this
}, SESSIONURL + 'securitytoken=' + SECURITYTOKEN + '&foo=' + foo);
Reply With Quote
  #5  
Old 03-05-2009, 11:21 AM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You say there is a dffenrent type of ajax used now with vbulletin how do I get documation for this and how do I setup the sender and reciever part.

As you know my javascript function needs to fire of some ajax to a handler of some kind on the server that is running PHP.

Now I have taken the first part of the calandar down to where the actaul start of the script and posted above and this was in hopes that someone would be able to make the changes in what I posted for me.

I put in the post the php function calls that I thought would at least deal with this and now I find there is a new way to do it no wonder I could not get any thing I tried to even remoty work or be close to any thing other then a buch of errors.

Would someone please go thorugh the setup part and explain in very clear details how to setup this so all I have to do is write the send and reciever functions.

I want to go from my javascript that is hooked to my form and resides in the same templete a custom one i modified and thorugh ajax store the values selected off into a log or some other thing I have to do before my javescript actual sends the form submit after housekeeping is complete.

The function doing the housekeeping is in PHP and that is what i am good in myself.

But I have never in my life done ajax so any help on this is very much needed.

THANKS

Frank H. Shaw
Reply With Quote
  #6  
Old 03-05-2009, 11:39 AM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi

i think you'll find all the answers on the yui page http://developer.yahoo.com/yui/connection/

here's a example how i'm using it:
Code:
var invites = {
		init:function()
		{
			YAHOO.util.Event.removeListener("ajaxinvites", "click", invites.init);
			YAHOO.util.Connect.asyncRequest("POST", "ajax.php?do=showinviteform", {
				success: invites.initform,
			    failure: vBulletin_AJAX_Error_Handler,
			    timeout: vB_Default_Timeout
			},SESSIONURL + "securitytoken=" + SECURITYTOKEN + "&do=showinviteform"); 
			
		},
		initform:function(a)
		{
			b = a.responseXML.getElementsByTagName("template")[0].firstChild.nodeValue;
			t = YAHOO.util.Dom.get('ajaxinvites').innerHTML;
			YAHOO.util.Dom.get('ajaxinvites').innerHTML = b;
			YAHOO.util.Event.on('sendinvite', 'click', invites.send, this, true);
		},
.....}
second example:
Code:
vBTwitter.prototype.senddirect = function(e)
{
	YAHOO.util.Event.stopEvent(e);
	YAHOO.util.Dom.get("progress_tweet").style.display='block';
	YAHOO.util.Connect.asyncRequest("POST", "tweet.php?do=tweet", {
		success: this.sended,
	    failure: vBulletin_AJAX_Error_Handler,
	    timeout: vB_Default_Timeout
	},SESSIONURL + "securitytoken=" + SECURITYTOKEN + "&do=tweet&tweet=" + PHP.urlencode(YAHOO.util.Dom.get('twitter_tweet').value) );  // TODO need to check which function to use here to code msg
}

vBTwitter.prototype.sended = function(a)
{
		var error = a.responseXML.getElementsByTagName("error")[0];
		if (error)
		{
			YAHOO.util.Dom.get("progress_tweet").style.display='none';
			alert(a.responseXML.getElementsByTagName("error")[0].firstChild.nodeValue);
		}
		else
		{
			YAHOO.util.Dom.get("progress_tweet").style.display='none';
			YAHOO.util.Dom.get('twitter_tweet').value = '';
			vBmenu.hide();
		}
}
Maybe its not the best way to use it, but thats the way i'm using it and its working
Reply With Quote
  #7  
Old 03-05-2009, 04:39 PM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would like to ask can you let me look at the file or files you are allready using and I can only assume that you are using ajax in vbulletin and if you have some really good PHP that I can use as a refernce to how you ingrated the ajax into your project it might help me sort this new stuff out.

THANKS

Frank H. Shaw
Reply With Quote
  #8  
Old 03-05-2009, 05:17 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm, just look at the ajax.php there you see the php part
and in the uncompressed js files you can see the js things

i think that will be better examples, then my code.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:19 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04147 seconds
  • Memory Usage 2,250KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete