使用 AJAX、HTML 和 C# 创建聊天框?
我在 C# 控制台应用程序中使用 Nancy Web 框架基本上为我的软件创建一个 Web 管理面板。我选择使用 Spark View Engine,因为它基本上只是 HTML。我基本上想创建一个聊天框,除了每隔 X 秒将数据写入应用程序的控制台并将其显示在一个框中。
我对 JQuery 和 AJAX 的经验很少,但从我见过的示例来看,它们并不算太复杂。我遇到的问题是所有聊天框和呼喊框示例都使用 PHP。
我基本上只需要这样的东西...
唯一的区别是我需要从我的应用程序代替。我可以在 HTML 中使用基本的 C# 方法(也可能在 javascript 中使用,但我还没有尝试过)。最好的方法是什么?是否有不使用 PHP 的示例?
I am using the Nancy Web Framework in my C# Console Application to basically create a Web Administration panel for my software. I have opted to use the Spark View Engine, as it is basically just HTML. I basically want to create a chatbox, except pull the data written to my application's console every X seconds and display it in a box instead.
I have very little experience with JQuery and AJAX, but they aren't overly complicated from the examples I have seen. The issue I am running into is that ALL of the chatbox and shoutbox examples use PHP.
I basically just need something like this...
The only difference is I need to pull the information from my application instead. I can use basic C# methods inside of the HTML (and probably inside of javascript but I haven't tried this). What would be the best way to do this, and are there any examples floating around that don't use PHP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是使用 AJAX 和 JSON 完成的。
This was completed using AJAX and JSON.
好吧,在某些 PC 程序中使用 HTML 进行样式设计是不明智的。不过,它有更好的 UI 引擎。但供您参考 这里有一个不错的 jQuery Shoutbox教程,但是,你只需要使用 C# 处理数据输入和输出,所以实际上我认为没有问题。您使用的引擎应该具有某种数据流或请求处理程序(
bla://program/???
)Well, to use HTML for styling inside some PC program is just not wise. It has much better UI engines, though. But for your information here is nice jQuery shoutbox tutorial, but well, you only need to handle data input and output with C#, so actually I see no problems. The engine which you are using should have some kind of data stream, or requests handler (
bla://program/???
)