PDA

View Full Version : Adding new ajax functionality


Broseph
02-03-2013, 11:22 PM
I'm trying to implement some ajax functionality and I'm having trouble with getting the required information in the back end. Here is the clientside code:

YAHOO.util.Connect.asyncRequest(
'POST',
'ajaxtest.php', {
success: function(data) {
console.log(data);
}
},
SESSIONURL + 'securitytoken=' + SECURITYTOKEN
);

And here is ajaxtest.php:

<?php

define('THIS_SCRIPT', 'ajaxtest');
define('CSRF_PROTECTION', true);

require_once('./global.php');

global $userinfo, $foruminfo;

print_r($userinfo);
print_r($foruminfo);

Looking at threadrate.php it seemed like that should be all I needed to do to get access to globals such as $foruminfo and $userinfo. The request is fired from a script that is loaded in the head of forumdisplay.php and I all I get is an empty array back.

Am I missing something?

Broseph
02-05-2013, 06:46 AM
I've figured out that to get $foruminfo, you just need to send a parameter "t" with the value of the current forumid. User info can be accessed from $vbulletin.