PDA

View Full Version : Using Yahoo Connection api


squishi
31 Dec 2011, 13:30
The vbulletin pages load the yahoo-dom-event and connection libraries.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I want to use those libraries to make ajax requests. I don't want to pack jquery on top of all the libraries that are already loaded.

So how would I make such a request?

Firstly, the documention for the yahoo connection manager states that "yahoo-min" is a prerequisite:
http://developer.yahoo.com/yui/connection/

I tried to do an ajax request like this, but nothing happens:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



So how is the connection even working in vbulletin? Why is the connection manager loaded when it depends on the yahoo library?

kh99
31 Dec 2011, 14:32
I tried this out and it works for me. I did have to remove the "+ the_hash" because it wasn't defined, but I assumed you just didn't include that code. How do you know it's not working? I'd suggest using something like FireFox with FireBug if you're not already.

squishi
31 Dec 2011, 15:13
So you don't have to load the yahoo-min.js library as a dependency?

kh99
31 Dec 2011, 15:17
I just copied your code in to the footer template, made a few changes to get it to run (liike the 'the_hash' thing and changing the url). I changed it to call misc.php?do=ajax then put a plugin on misc_start that just has:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Then using Firebug I could see that it was making the request and getting the "foo" response. So no, I didn't have to add any js files.

squishi
31 Dec 2011, 21:36
Okay, thanks. You are always very helpful, kh99!

--------------- Added 1325434992 at 1325434992 ---------------

I've had a look at Firebug now. It was a missing security token that was causing the problems.