gpt4 book ai didi

加载 Rails 部分的 jQuery 函数?

转载 作者:数据小太阳 更新时间:2023-10-29 08:02:02 24 4
gpt4 key购买 nike

我有一个 jQuery 函数,每隔几秒就会更新我的数据。

但是!它没有解析正在加载的 javascript。它只是每隔几秒适本地调用一次,并用未解析的 javascript 代码替换我的内容。

setupMediaIndexPoller: function(organization) {
url = '/organizations/' + organization + '/media/photos_and_video'
$.PeriodicalUpdater(url, {
method: 'get',
data: '',
minTimeout: 20000,
maxTimeout: 60000,
multiplier: 2,
type: 'html',
maxCalls: 0,
autoStop: 0
}, function(data) {
$('#media_index').html(data);
});
}

我尝试制作 dataType: script,但这没有帮助。有什么想法吗?

最佳答案

您想将此字符串作为 javascript 求值吗?如果是这样,请使用 Javascript 的 eval 函数:

http://www.w3schools.com/jsref/jsref_eval.asp

关于加载 Rails 部分的 jQuery 函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3762870/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com