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 05-09-2008, 07:31 PM
ZomgStuff ZomgStuff is offline
 
Join Date: Feb 2007
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Quick AJAX Question with 3.7

Well before I had a rating mod installed in which after you clicked on an icon besides a user's name, you would get a CSS pop-up with an AJAX request for the ratings that they received. It seems as though the AJAX system has been changed in 3.7 and I need a little help.

Before after clicking on the button it would open up a little box besides the button and display the information, now, it does not display anything but yet it is still responding with the correct information.


The link leads to ajax.php?do=ratebox&uid=XXXX (with the securitytoken as a parameter), which then gets the response of
PHP Code:
<div style="width: 130px; float: left;">Was Rated<br /><br /><div class="rate_it_display_box" style="background-image

: url('images/rate/agree.png');"
>

    <
a href="#" onclick="return showWhoVoted( 5428 , 1 , 0 );">140 x Agree</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/funny.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 7 , 0 );">114 x Funny</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/goldstar.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 2 , 0 );">67 x Gold Star</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/zing.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 5 , 0 );">63 x ZING</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/artistic.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 9 , 0 );">21 x Artistic</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/thanks.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 4 , 0 );">21 x Thanks</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/informative.png');"

>

    <
a href="#" onclick="return showWhoVoted( 5428 , 3 , 0 );">17 x Informative</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/goodidea.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 8 , 0 );">15 x Good Idea</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/goodfind.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 10 , 0 );">13 x Good Find</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/useful.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 6 , 0 );">7 x Useful</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/disagree.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 11 , 0 );">1 x Disagree</a>

</
div></div><div style="width: 130px; float: left;">Ratings Given<br /><br /><div class="rate_it_display_box"

 
style="background-image: url('images/rate/agree.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 1 , 1 );">100 x Agree</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/goldstar.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 2 , 1 );">43 x Gold Star</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/funny.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 7 , 1 );">35 x Funny</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/zing.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 5 , 1 );">35 x ZING</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/thanks.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 4 , 1 );">34 x Thanks</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/goodidea.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 8 , 1 );">25 x Good Idea</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/artistic.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 9 , 1 );">16 x Artistic</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/informative.png');"

>

    <
a href="#" onclick="return showWhoVoted( 5428 , 3 , 1 );">14 x Informative</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/goodfind.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 10 , 1 );">13 x Good Find</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/useful.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 6 , 1 );">6 x Useful</a>

</
div><div class="rate_it_display_box" style="background-image: url('images/rate/wtf.png');">

    <
a href="#" onclick="return showWhoVoted( 5428 , 12 , 1 );">1 x WTF</a>

</
div></div
Only problem is that it does not create the box pop-up anymore, how can I get the response to actually output the information into a div container.

Here is the js function that is responsible for requesting the AJAX request.
Code:
function showRateBox( $userid, $securitytoken, $clicked, e )
{
  ;
	if (ajRB)
	{
		alert( 'One at a time you dork' );
		return;
	}

	if ( RateWindow )
	{
		document.body.removeChild( RateWindow );
		delete RateWindow;
		RateWindow = false;
	}

	ClickX = MouseX + 10;
	ClickY = MouseY;
	YAHOO.util.Connect.asyncRequest('POST', 'ajax.php?do=erategetbox&uid=' + $userid , {
	success: this.handle_ajax_response,
	failure: this.handle_ajax_error,
	timeout: vB_Default_Timeout,
	scope: this
}, SESSIONURL + 'securitytoken=' + SECURITYTOKEN);

	return false;
}

Thanks in advance.
Reply With Quote
  #2  
Old 05-11-2008, 12:46 PM
Guest190829
Guest
 
Posts: n/a
Default

You need to define the function to handle the response success. You've done this, but you haven't actually defined handle_ajax_response to be called...so nothing will happen.

you can do: success: function(yobj) {
// Display pop up here
},

I believe.
Reply With Quote
  #3  
Old 05-11-2008, 01:35 PM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Also, unless you are using the prototype method, don't reference the object "this" for your handler function.
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 02:35 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06690 seconds
  • Memory Usage 2,220KB
  • 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
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (2)postbit_onlinestatus
  • (3)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