WebConsole –使用AJAX接受命令(行)

My article describing how to create a simple Javascript XMLHTTP application is now featured on SitePoint. How cool is that!

我的文章描述了如何创建一个简单的Javascript XMLHTTP应用程序,现在已在SitePoint发表。 多么酷啊!

A bit of history: several months ago I thought SitePoint, my daily read, was missing an intro article on AJAX, so I sat down and wrote one. Meanwhile, while I was preparing it, SitePoint published this excellent AJAX tutorial by Cameron Adams. (Do check this guy's site! He definitely knows his JS!) His article was overlapping mine in the intro part. So I thought it doesn't make sense to have two intro articles and revised mine, basically stripping the intro part and leaving just the second part - the creation of a simple WebConsole application - a web interface for executing shell commands (Try it out here). This second part of the article was published today on SitePoint and I'm quite proud of that fact 😉

一段历史:几个月前,我以为我每天读的SitePoint都缺少关于AJAX的介绍性文章,所以我坐下来写了一篇。 同时,在准备过程中,SitePoint发布了Cameron Adams撰写的出色的AJAX教程。 (请检查此人的网站!他绝对知道他的JS!)他的文章在介绍部分与我的文章重叠。 因此,我认为有两篇介绍性文章和我的修订版是没有意义的,基本上删除了介绍性部分,只剩下第二部分-创建一个简单的WebConsole应用程序-一个用于执行Shell命令的Web界面(请在此处进行尝试) )。 本文的第二部分今天在SitePoint上发布,对此我感到非常自豪😉

Then some time later I saw that DevMo - Mozilla Developers Wiki - started an AJAX section and there was an invitation on it for somebody to write the "Getting Started" article, that was missing at the time. And since I had my intro tutorial lying around, I just published it right there on the Wiki.

然后过了一段时间,我看到DevMo(Mozilla开发人员Wiki)开始了AJAX部分,并在上面邀请有人写“入门”文章,当时该文章不见了。 既然我的入门教程在身边,所以我就在Wiki上发布了它。

So if you're new to the XMLHTTP (AJAX) concept and looking for a place to start:

因此,如果您不熟悉XMLHTTP(AJAX)概念,并且正在寻找一个起点:

  • Start with the DevMo article, then

    DevMo文章开始,然后

  • Read through the SitePoint articles - Cameron's and mine, then

    通读SitePoint文章-卡梅隆的我的,然后

  • Check the links at the end of the SitePoint article, then/or

    检查SitePoint文章末尾的链接,然后/或者
  • ...just experiment on your own!

    ...只是自己试验!

BTW, as another real-life example of the reusable JS function for making requests, which is discussed in the SitePoint's article, check this out. It's a little AJAX touch for phpBB, scroll down where it says "Word of the day" and "Mot du jour", click. How is it working? Well, I have a simple PHP script that hits two RSS feeds - Dictionary.com and a French blogger's. My script caches the XML file just not to abuse the RSS feeds with too many requests (not that this site has a lot of requests, but still). So the PHP script basically copies the feeds as two XML files on my server - wotd.xml (as in Word of The Day) and mdj.xml (Mot du Jour). Steps in JavaScript! When you load the forum's index page nothing special happens. When you click though, an HTTP request is performed, the requested XML file is retrieved, parsed, and the contents we want - displayed. Pretty easy thing to do, using the same JS function for making requests, described in the article.

顺便说一句,作为可重复使用的JS功能提出请求,这是SitePoint的文章中讨论的另一个活生生的例子,检查了这一点。 这是phpBB的一点AJAX风格,向下滚动显示“每日一词”和“ Mot du jour”,单击。 如何运作? 好吧,我有一个简单PHP脚本,其中包含两个RSS提要-Dictionary.com和一个法国博客作者。 我的脚本缓存XML文件只是为了不滥用太多请求的RSS提要(不是这个站点有很多请求,但仍然如此)。 因此,PHP脚本基本上将提要复制为服务器上的两个XML文件-wotd.xml (如每日一词)和mdj.xml (Mot du Jour)。 JavaScript步骤! 当您加载论坛的索引页面时,没有什么特别的事情发生。 当您单击时,将执行HTTP请求,检索,解析所请求的XML文件,并显示我们想要的内容。 使用相同的JS函数进行请求非常容易做到,如本文所述。

Tell your friends about this post on Facebook and Twitter

FacebookTwitter上告诉您的朋友有关此帖子的信息

翻译自: https://www.phpied.com/ajax-web-console/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值