Witam,

[JAVASCRIPT] pobierz, plaintext
  1. /*
  2. * Method to sort by user type
  3. *
  4. * @param int Sort Key
  5. * @retun string New HTML
  6. */
  7. sortLogs: function( sortType )
  8. {
  9. /* Change indicator! */
  10. var sortOrder = ipb.FGClass.sortOrder = ( ipb.FGClass.sortKey == sortType ) ? !ipb.FGClass.sortOrder : 0;
  11. var tempData = 0;
  12.  
  13. /* Save sort key! */
  14. ipb.FGClass.sortKey = sortType;
  15.  
  16. /* No client Cache? */
  17. if( Object.isUndefined( ipb.FGClass.cacheTable[ ipb.FGClass.sortKey ] ) )
  18. {
  19. /* Get Transacions! */
  20. var _url = ipb.vars['base_url'] + 'app=fg&module=ajax&secure_key=' + ipb.vars['secure_hash'] + '&section=logs&do=getTransactions';
  21.  
  22. new Ajax.Request( _url,
  23. {
  24. method: 'post',
  25. evalJSON: 'force',
  26. parameters:
  27. {
  28. 'sortType' : ipb.FGClass.sortKey,
  29. 'isModeratorSection' : ( ipb.FGClass.isModeratorSection ) ? 1 : null,
  30. 'moderatedMember' : ( ipb.FGClass.moderatedMember ) ? ipb.FGClass.moderatedMember : null
  31. },
  32. onComplete: function( returnResponse )
  33. {
  34. /* Update Cache */
  35. tempData = returnResponse.responseJSON['transactionsData'];
  36. }
  37. }
  38. );
  39. }
  40.  
  41. /* Save Cache */
  42. ipb.FGClass.cacheTable[ ipb.FGClass.sortKey ] = tempData;
  43. },
[JAVASCRIPT] pobierz, plaintext


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?