我需要一种方法来检索远程网页的标题。我在互联网上找到了这个js但是 有人可以告诉我 "$.request("fetch_title", { url: c })"在这个函数中做了什么:?
function fetch_title() {
var a = $("#url-field"),
b = a.find(".NO_URL"),
a = a.find(".title-status"),
c = $("#url").val();
if (c) {
if (!$('form#newlink textarea[name="title"]').val() || confirm("This will replace your existing title, proceed?"))
a.show().text(reddit.status_msg.loading),
b.hide(),
$.request("fetch_title", { url: c })
} else a.hide(), b.show().text("a url is required")
}
最佳答案
核心 jQuery 中没有 jQuery.request()
函数,因此它很可能是由插件实现的。我在 Google 上找到的最接近的是 AmplifyJS ,它被描述为“jQuery 组件库”。但是,文档中没有表明使用 $
代替 amplify
可行。
取自上面链接的页面:
amplify.request is an abstraction layer that can be used for any kind of request for data. amplify.request sets out to separate the data retrieval and caching mechanisms from data requestors.
这似乎是基于用户输入的指定 URL 来请求页面标题,但请求的具体细节将在代码的其他位置。
关于javascript - 如何在 JavaScript 中检索页面标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15382849/