PDA

View Full Version : Need a very simple example AJAX script in vbb


mokujin
07-24-2008, 08:51 PM
Hi all, I am learning AJAX but I need some example, ex. for loading a text from another php file
I read articles but they are not enough yet.
Thank you

Lynne
07-24-2008, 10:33 PM
Have you tried doing a search in the modifications forums for mods with the word "ajax" in the title and then downloading them and taking a look at the code?

Dismounted
07-25-2008, 06:41 AM
AJAX in general, or AJAX in vBulletin?

mokujin
07-25-2008, 05:12 PM
Have you tried doing a search in the modifications forums for mods with the word "ajax" in the title and then downloading them and taking a look at the code?
HI, yes of course that I have tried search all ajax mods, but you know, I dont understand them that all :(

AJAX in general, or AJAX in vBulletin?

Hi, I need AJAX in vBulletin, I am trying to code my first mod with AJAX.

Lynne
07-25-2008, 05:31 PM
ajax is basically javascript, so if you have an understanding of javascript, you can probably just go from there.

Did you check out the Articles forums?
[Tutorial] Developers Introduction To AJAX Technology (https://vborg.vbsupport.ru/showthread.php?t=81626&highlight=ajax)
Intergrating AJAX Technology Into Your Modifications (https://vborg.vbsupport.ru/showthread.php?t=93249&highlight=ajax)

mokujin
07-25-2008, 06:38 PM
yes i know a bit of javascript, but ajax, i need step to write it. thanks

Dismounted
07-26-2008, 04:54 AM
I don't think there are any up-to-date tutorials on AJAX in vBulletin (after it switched to using YUI).

MoT3rror
07-26-2008, 05:19 AM
<a href="http://developer.yahoo.com/yui/connection/" target="_blank">http://developer.yahoo.com/yui/connection/</a>

mokujin
07-27-2008, 05:49 PM
thanks all for helping me. I have the function how to call back script with a form (I mean something like <a href="#" onclick="myfunction(1,true)"> my text id 1 </a> .

But I need from a link, I mean http://mysite.com/myscript.php?#,1 => Where 1 is my text id and call to the script without by click a form.

I hope that you understand, my english is too bad.

Thank you again :)

Dismounted
07-28-2008, 06:20 AM
You need to call your PHP script via AJAX in "myfunction()".

Opserty
07-28-2008, 07:37 AM
After a quick look yesterday, I found the vbulletin_reputation.js file probably the simplest one to understand. You may be better off investigating that.

I doesn't look like an easy task though! :D

Dismounted
07-28-2008, 11:51 AM
The only thing you (really) need to know for AJAX apart from coding the PHP response and basic Javascript is this little piece of 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);

mokujin
07-28-2008, 07:17 PM
Its too difficult for me now :D
Can you Ops or Dis make a demo for me? I know that it takes too much time :)

Thank you so much :)

Dismounted
07-29-2008, 06:45 AM
My suggestion is to look at someone else's code - but you don't really need to as I've given you the Javascript for AJAX calls already.

mokujin
07-29-2008, 07:13 PM
Hi, I have looked at some codes but I dont know how to :((

I saw someone else's code that they use onLoad on body tag. Can I use that tag?

Or please Dismounted could you write a code for me? Thank you so much

Dismounted
07-30-2008, 06:52 AM
I have written the code for you...

mokujin
07-31-2008, 06:15 PM
Thanks, but I cant use the code :( I have seen that hack (https://vborg.vbsupport.ru/showthread.php?t=181741&highlight=forum), it has function what I need. Can you help me again?