在Web.config文件中添加Ajax轮询时间,并访问值?

编程入门 行业动态 更新时间:2024-10-22 22:57:08
本文介绍了在Web.config文件中添加Ajax轮询时间,并访问值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的web.config文件中有这个namevaluesectionhandler,用于设置三个ajax部分视图的轮询时间:

I have this namevaluesectionhandler in my web.config file that sets the poll time of three ajax partial views:

<section name="PollIntervall" type="System.Configuration.NameValueSectionHandler"/> <PollIntervall> <add key="server_poll" value="20000"/> <add key="build_poll" value="5000"/> <add key="feed_poll" value="5000"/> </PollIntervall>

我试图引用这些,但我有一个方法在.js文件中执行ajax调用。关于我应该怎么做的任何想法? (我需要在脚本中切换出硬编码区间,并用web.config文件中的值替换它。)

I am trying to reference these, but I have the method that does the ajax call in a .js file. Any ideas on how I should go about doing this? (I need to switch out the hard coded intervals in my script, and replace it with the values from the web.config file.)

var ajaxFunctionMaker = function(callbackFillElementSelector, serverUrl, interval) { var ajaxfunc = function () { $.ajax({ type: 'GET', cache: false, accepts: 'application/json', success: function (partialView) { $(callbackFillElementSelector).html(partialView); //updateCounter(); $.event.trigger('ajaxreturn'); setTimeout(ajaxfunc, interval); }, error: function (jqXHR, textStatus, errorThrown) { //updateCounter(); }, url: serverUrl }); }; return ajaxfunc; }; ajaxFunctionMaker('#serverview', '/BuildMonitor/PollServer', 20000)(); ajaxFunctionMaker('#buildview', '/BuildMonitor/PollBuild', 5000)(); ajaxFunctionMaker('#feed', '/BuildMonitor/PollFeed', 5000)(); })();

推荐答案

正确的论坛是forums.asp。 The correct forum would be forums.asp.

更多推荐

在Web.config文件中添加Ajax轮询时间,并访问值?

本文发布于:2023-11-25 02:13:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1627904.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   时间   Web   config   Ajax

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!