如何在phpfox上进行ajax网站范围的浏览? [英] how ajax site wide browsing works on phpfox?
问题描述
我正在尝试在phpfox上使用Ajax宽浏览,但是我不明白它是如何工作的, 有什么主意吗? 我在static/jscript/main.js中找到以下代码:
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 ?
推荐答案
要像在整个网站范围内进行ajax浏览一样建立链接,您可以像往常一样进行操作,phpfox会为您解决.
To make a link for site wide ajax browsing you do it just like usual, phpfox will figure it out for you.
如果要在phpfox中进行ajax调用,请执行以下操作:
If you want to make an ajax call in phpfox you do:
$.ajaxCall('module.function', 'param1=value1¶m2=value2');
例如:
$.ajaxCall('ad.recalculate', 'total=' + iTotal + '&location=' + sLocation + '&block_id=' + sBlockId + '&isCPM=' + $Core.Ad.isCPM);
在文件/module/ad/include/component/ajax/ajax.class.php中调用函数重新计算并传递以下参数:total,location,block_id和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
这篇关于如何在phpfox上进行ajax网站范围的浏览?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!