gpt4 book ai didi

javascript - 为什么 RSS 脚本无法加载? jQuery

转载 作者:行者123 更新时间:2023-12-03 07:20:52 27 4
gpt4 key购买 nike

我有这个代码:

<script src="http://code.jquery.com/jquery-2.2.2.min.js"></script>
<!-- start feedwind code -->
<!-- select protocol http or https -->
<script type="text/javascript">
$.holdReady(true);
$.getScript("http://feed.mikle.com/js/rssmikle.js",
function() { $.holdReady(false); });
console.log( "Load was performed." );
</script>

<!--<script type="text/javascript" src="http://feed.mikle.com/js/rssmikle.js"></script>-->
<script type="text/javascript">
var params = {
rssmikle_url: "http://althouse.blogspot.com",
rssmikle_frame_width: "400",
rssmikle_frame_height: "400",
frame_height_by_article: "3",
rssmikle_target: "_blank",
rssmikle_font: "Arial, Helvetica, sans-serif",
rssmikle_font_size: "12",rssmikle_border: "off",
responsive: "off",rssmikle_css_url: "",
text_align: "left",
text_align2: "left",
corner: "off",
scrollbar: "on",
autoscroll: "on",
scrolldirection: "up",
scrollstep: "3",
mcspeed: "20",
sort: "Off",
rssmikle_title: "on",
rssmikle_title_sentence: "",
rssmikle_title_link: "",
rssmikle_title_bgcolor: "#0066FF",
rssmikle_title_color: "#FFFFFF",
rssmikle_title_bgimage: "",
rssmikle_item_bgcolor: "#FFFFFF",
rssmikle_item_bgimage: "",
rssmikle_item_title_length: "55",
rssmikle_item_title_color: "#0066FF",
rssmikle_item_border_bottom: "on",
rssmikle_item_description: "on",
item_link: "off",
rssmikle_item_description_length: "150",
rssmikle_item_description_color: "#666666",
rssmikle_item_date: "gl1",
rssmikle_timezone: "Etc/GMT",
datetime_format: "%b %e, %Y %l:%M %p",
item_description_style: "text+tn",
item_thumbnail: "full",
item_thumbnail_selection: "auto",
article_num: "15",
rssmikle_item_podcast: "off",
keyword_inc: "",
keyword_exc: ""
};
(function(params) {
console.log( "Function started" );

feedwind_show_widget_iframe(params);
}
)(params);</script>
<div style="font-size:12px; text-align:center; width:300px;">
<a href="http://feed.mikle.com/" target="_blank" style="color:#CCCCCC;">RSS Feed Widget</a>
<!--Please display the above link in your web page according to Terms of Service.--></div>
<!-- end feedwind code --><!-- end feedwind code -->

它应该从 mikle.com 加载 RSS,这样您就应该看到帖子列表。我想使用 Jquery 加载脚本。我用了 $.holdReady(true);所以函数 feedwind_show_widget_iframe(params);下载脚本之前不应调用。我还在控制台中看到文件已加载,然后函数被调用的日志。如果我用 Mikel 的 RSS 取消注释脚本标记,那么一切都会正常,但我想动态加载它。

最佳答案

当您调用getScript时您向其传递一个回调( function() { $.holdReady(false); } ),以便在脚本加载后执行。

您已放置依赖于该脚本的代码,以便它在您开始请求脚本后立即运行,而不是在脚本可用后运行的回调中运行。

关于javascript - 为什么 RSS 脚本无法加载? jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36218582/

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