当您提出问题时,stackoverflow 如何在下面的标签输入中加载其可用标签?他们是在页面加载时填充可用标签还是根据用户输入或用户按键发出请求?我计划在我的应用程序中实现相同的方式,但我不知道如何实现这一目标。
问问题
93 次
1 回答
1
他们肯定不会在页面加载时加载所有可用的标签,因为太多了。我在 Firefox 的 Web 控制台下进行了快速测试,看起来他们使用 AJAX 执行 JSON 请求。一个例子是:
https://stackoverflow.com/filter/tags?q=visual&newstyle=true&_=1359502308905
导致响应:
[{"Name":"c#","Synonyms":"visual-c#","Count":409187,"Excerpt":"C# is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines. It was developed by Microsoft for use with their .NET framework and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270:2006). It is now also available on different platforms (Android, Linux, iOS) via the MONO project."},{"Name":"visual-studio-2010","Synonyms":"visual-studio-2010-rtm","Count":30434,"Excerpt":"Visual Studio is an integrated development environment (IDE) from Microsoft."},{"Name":"visual-studio","Synonyms":"visualstudio","Count":25157,"Excerpt":"Visual Studio is an integrated development environment (IDE) from Microsoft. It supports many different programming languages."},{"Name":"visual-studio-2008","Synonyms":"visualstudio2008","Count":13539,"Excerpt":"This tag refers to the Visual Studio line of software development products from Microsoft, the 2008 version."},{"Name":"visual-c++","Synonyms":"visualc++","Count":12298,"Excerpt":"Microsoft Visual C++ is a C and C++ compiler for Windows. The most recent version of the compiler is Visual C++ 2012, which is available in both commercial editions and in a free Express Edition.\r\n\r\nThe compiler supports the following languages:\r\n\r\n\r\nC: Only the C90 standard is supported; there is very limited C99 support\r\nC++: Also includes support for several major C++11 features as of Visual Studio 2010\r\nC++/CLI and .NET Managed Extensions for C++"},{"Name":"vba","Synonyms":"visual-basic-applications","Count":12195,"Excerpt":"Visual Basic for Applications (VBA) is an event-driven programming language which was first introduced by Microsoft in 1993 to give Excel 5.0 a more robust object-oriented language for writing macros and automating the use of Excel. It is now used for the entire Office suite. If your question is specifically about programming Excel, Access, Word or Outlook, use the appropriate tag: excel-vba, access-vba, word-vba or outlook-vba."}]
它们似乎也有点滞后,因此它们不会一次触发太多 HTTP 请求。在它发出请求之前,您必须停止输入一两秒钟。
于 2013-01-29T23:33:10.593 回答