Witam,
/*
* Method to sort by user type
*
* @param int Sort Key
* @retun string New HTML
*/
sortLogs: function( sortType )
{
/* Change indicator! */
var sortOrder = ipb.FGClass.sortOrder = ( ipb.FGClass.sortKey == sortType ) ? !ipb.FGClass.sortOrder : 0;
var tempData = 0;
/* Save sort key! */
ipb.FGClass.sortKey = sortType;
/* No client Cache? */
if( Object.isUndefined( ipb.FGClass.cacheTable[ ipb.FGClass.sortKey ] ) )
{
/* Get Transacions! */
var _url = ipb.vars['base_url'] + 'app=fg&module=ajax&secure_key=' + ipb.vars['secure_hash'] + '§ion=logs&do=getTransactions';
new Ajax.Request( _url,
{
method: 'post',
evalJSON: 'force',
parameters:
{
'sortType' : ipb.FGClass.sortKey,
'isModeratorSection' : ( ipb.FGClass.isModeratorSection ) ? 1 : null,
'moderatedMember' : ( ipb.FGClass.moderatedMember ) ? ipb.FGClass.moderatedMember : null
},
onComplete: function( returnResponse )
{
/* Update Cache */
tempData = returnResponse.responseJSON['transactionsData'];
}
}
);
}
/* Save Cache */
ipb.FGClass.cacheTable[ ipb.FGClass.sortKey ] = tempData;
},
Powoli opiszę problem. Dzięki tej funkcji chcę sortować informacje w tabeli. Skrypt Ajax działa dobrze, zwraca obiekty JSON i ich dobrą zawartość. W czym leży problem? Otóż, kiedy próbuję się dostać do zmiennej tempData ona ma wartość jakby była inicjowana. Czemu tak się dzieje?