vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   [Discuss] Developers use of AJAX Technology (https://vborg.vbsupport.ru/showthread.php?t=81677)

Marco van Herwaarden 05-18-2005 10:17 AM

[Discuss] Developers use of AJAX Technology
 
Please use this thread to discuss the use of AJAX technology and how we can make optimal use of it in integration with vBulletin.

Interesting links to use as resource on this topic are:
- [Tutorial] Developers Introduction To AJAX Technology by Zero Tolerance

For those who want some "sneak previews", the following vB3.0.7 hacks using AJAX have been released:
- AJAX Fast Open/Close Threads (vB 3.5 Replication) by Zero Tolerance
- AJAX: check if username exists on registration in realtime by MrNase
- AJAX: check for banned email on registration and changing mail by MrNase


Interesting links on the web about coding AJAX in General:

Interesting links on the web about AJAX in General:

Corriewf 05-18-2005 03:41 PM

What is the deal with all of these ajax hacks? Is this software integrated into one of the vb versions or can all use this?

Marco van Herwaarden 05-18-2005 06:29 PM

AJAX is not some finished software, it is the combined use of some techniques. It combines the use of JavaSciript with XML and Asynchronous communicition with the server.

Corriewf 05-19-2005 12:45 PM

So when I see AJAX hack(s) its referring to a format of coding vs and addon to software? What is the required version of vbulletin to utilize it?

Marco van Herwaarden 05-19-2005 01:38 PM

There is no requirement of the vB version. It is the capability of your browser that could be limiting it. All major browser support it, but you must have javascript turned on.

AJAX is nothing more then a technique that make some things possible that are very difficult without AJAX. It is up to the coders if and how they will use it.

Corriewf 05-19-2005 02:00 PM

From the end user perspective (me :) ) what is the benefit of using this vs using templates and php code ect ?

Zero Tolerance 05-19-2005 02:12 PM

The benefit from AJAX technology is it allows functions to be "real-time", this is its prime feature, the ability to send and recieve data to a server without any reloading of the page or iframes. Which is one thing internet applications lacked, and where desktop applications had the upper hand.

But now with ajax technology, you can develop applications where sections if not the whole thing doesn't require any reloading at all, think of it as a stream video link instead of having to download it all before viewing it, you'd prefer to view the stream instead of waiting for the download.

- Zero Tolerance

Corriewf 05-19-2005 02:24 PM

Yeah that does sound very nice. Wonder why the hacks coming out utilizing this code are task which are rarely used, instead of repetitive tasks.

What would be GREAT is a hack that would update the current post on the main index page without having to refresh to see new posts.

Marco van Herwaarden 05-19-2005 02:28 PM

Quote:

Originally Posted by corriewf
Yeah that does sound very nice. Wonder why the hacks coming out utilizing this code are task which are rarely used, instead of repetitive tasks.

What would be GREAT is a hack that would update the current post on the main index page without having to refresh to see new posts.

Although that would technically be possible, it would probably kill your server.

Even with AJAX, that data must still be requested, retrieved from the MySQL database, passed back to the client, and then all controls would need to be updated.

Corriewf 05-19-2005 03:17 PM

Yeah but if you could set the refresh rate to accommodate the server load it would be perfect.

Zero Tolerance 05-19-2005 05:27 PM

I guess a 1 minute time out for the data reload wouldn't be too harsh, aslong as the page requested minimal queries, like the session, other requirements and then the data itself.

Depends really how active your site is, a site with 100+ users on most of the time would really need to put the time out higher, say 3/4 minutes, but the content would still remain intact.

But things like getting last x posts would only take 1 query, you could even use the XML output as a feed for your main site :)

- Zero Tolerance

Guy G 05-20-2005 06:14 AM

Great tutorial... For anyone that has no idea on what it is and such just check your Gmail account... Gmail is based on AJAX.

Corriewf 05-20-2005 12:27 PM

Quote:

Originally Posted by Zero Tolerance
I guess a 1 minute time out for the data reload wouldn't be too harsh, aslong as the page requested minimal queries, like the session, other requirements and then the data itself.

Depends really how active your site is, a site with 100+ users on most of the time would really need to put the time out higher, say 3/4 minutes, but the content would still remain intact.

But things like getting last x posts would only take 1 query, you could even use the XML output as a feed for your main site :)

- Zero Tolerance


ZT your the king of refreshing hacks...... I know you could do this.

Have it in the admin control panel where the admin could have it refresh everything and then at what rate (time) OR could just have it refresh certain aspects at inputted rate.

You know how much this would save bandwidth and site speed wise? Members wouldnt have to refresh ( which would be calling everything) just to get up to date info on just post or ect.

Yeah, im likeing this AJAX now.

untold4you 05-24-2005 05:45 AM

Check this one out, http://blog.joshuaeichorn.com/archiv...d-with-jpspan/

Quote:

JPSpan provides a lot more functionality then SAJAX, the biggest difference you notice on the javascript side of thing is that you have mapped objects, on the php side the biggest difference is that you have a server page and a client page.
And another nice tutorial: http://www.webpasties.com/xmlHttpRequest/

Found out what the readyState codes are:
Code:

readyState Status Codes:
        0 = uninitialized
        1 = loading
        2 = loaded
        3 = interactive
        4 = complete


DaveAK 01-01-2006 07:25 PM

This may seem like an obvious question, but I'm trying to clear this up in my mind.

Scenario : Client A sends data to server. Server applies rules checking to data. Client B requests the data from Client A from the server.

OK, so if I get this right Client B "polls" the server for new data, which is similar to refreshing, but the big difference is that only the data is refreshed, not the whole page. Client side scripting takes care of rendering the page with the new data.

So if I'm right, you have to set your script up with a timer that checks the server for new data on a regular basis, i.e. it's not "event" based with the server triggering a client side function.

Did I get this right or have I just talked in circles? :)

So you have to set your timers to a realistic "refresh rate" depending on the size of data/server load these AJAX requests trigger. How is the best way to determine this refresh rate?

DaveAK 01-08-2006 03:38 AM

Anybody? :)

mrpaint 10-26-2006 11:39 AM

HTML Code:

function doTheTask() {
        do_box = new vB_AJAX_Handler(true)
        do_box.onreadystatechange(do_box_Done)
        do_box.send('url','&var1=1&var2=2')
                               
        do_button = new vB_AJAX_Handler(true)
        do_button.onreadystatechange(do_button_Done)
        do_button.send('url')                                                       
}                       
function do_box_Done() {
        if (do_box.handler.readyState == 4 && do_box.handler.status == 200) {
                ....
        }       
}
function do_button_Done() {
        if (do_button.handler.readyState == 4 && do_button.handler.status == 200) {
                ....
        }                       
}

I added this script but I have got this error message:
Quote:

Error: do_box is not defined
Line: if (do_box.handler.readyState == 4 && do_box.handler.status == 200) {
And this one
Quote:

Error: do_button is not defined
Line: if (do_button.handler.readyState == 4 && do_button.handler.status == 200) {
Anybody help me?

Wild-Wing 11-06-2006 11:57 AM

its just now i understand part of it thanks to Zero Tolerance's tutorial

mokujin 07-22-2008 06:38 PM

Does anyone can make some very simple demo script? I think that's better for beginners :)
Thank you so much

Marco van Herwaarden 07-23-2008 07:15 AM

There are plenty of examples around in both the Articles section and in existing modifications.


All times are GMT. The time now is 02:07 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.01234 seconds
  • Memory Usage 1,766KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (20)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete