0

i'm trying to use ajax wide browsing on phpfox but i dont understand how it works, any idea please ? i found in static/jscript/main.js this code :

$Core.ajax = function(sCall, $oParams)
 {
var sParams = '&' + getParam('sGlobalTokenName') + '[ajax]=true&' +             getParam('sGlobalTokenName') + '[call]=' + sCall;

if (!sParams.match(/\[security_token\]/i))
{
    sParams += '&' + getParam('sGlobalTokenName') + '[security_token]=' +    oCore['log.security_token'];
}

if (isset($oParams['params']))
{
    if (typeof($oParams['params']) == 'string')
    {
        sParams += $oParams['params'];
    }
    else        
    {
        $.each($oParams['params'], function($sKey, $sValue)
        {
            sParams += '&' + $sKey + '=' + encodeURIComponent($sValue) + '';
        });
    }       
}

$.ajax(
{
    type: (isset($oParams['type']) ? $oParams['type'] : 'GET'),
    url: getParam('sJsStatic') + "ajax.php",
    dataType: 'html',
    data: sParams,
    success: $oParams['success']
}); 
 };

I'm trying to fix a module of chat while browsing on my site Any idea plz ?

Mohamed
  • 19
  • 4

1 Answers1

1

To make a link for site wide ajax browsing you do it just like usual, phpfox will figure it out for you.

If you want to make an ajax call in phpfox you do:

$.ajaxCall('module.function', 'param1=value1&param2=value2');

for example:

$.ajaxCall('ad.recalculate', 'total=' + iTotal + '&location=' + sLocation + '&block_id=' + sBlockId + '&isCPM=' + $Core.Ad.isCPM);

Calls the function recalculate in the file /module/ad/include/component/ajax/ajax.class.php and passes the params: total, location, block_id and isCPM

Purefan
  • 1,498
  • 24
  • 44
  • thnx for your answer, i have a module of chat and i'm trying to make it usually active while bowsing on th site, so i would like to load the contenu of the oher modules and let the chat active. the module of chat is coded with java – Mohamed Mar 21 '14 at 15:31
  • Sounds useful. I dont like java though but if you just want a ready product check prochatrooms or cometchat, they both offer integrations with phpfox – Purefan Mar 22 '14 at 16:01