how ajax site wide browsing works on phpfox?

感情迁移 提交于 2019-12-13 07:39:05

问题


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 ?


回答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



来源:https://stackoverflow.com/questions/22559872/how-ajax-site-wide-browsing-works-on-phpfox

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!