HTML:元描述标签的用途(HTML: Meta description tag's uses)
我正在开发一个只在公司内部使用的网站,而唯一进入网站的方法是在不同网站启动的弹出式窗口中。 是否有任何理由我应该包含
<meta name="description" content="blah blah" /
>标记? 除了搜索引擎之外,还有什么其他原因需要描述meta标签?I'm working on a web site that is only used internally in the company, and the only way to get to site is in a popup window launched by different web site. Is there any reason I should include a
<meta name="description" content="blah blah" /
> tag? Besides search engines what other reason is there to have a description meta tag?
原文:https://stackoverflow.com/questions/6084144
最满意答案
你的承诺链是一团糟,你的意图远非清晰,所以这是一个基于你的代码松散的例子,以展示你如何使事情更容易理解。
$.ajax({url: '/echo/json'}) //do one request .then(function(resultFromServer){ //yay! 1st request was successful return $.ajax({url: '/echo/json'}); //then do another request },function(err){ //something went wrong with the AJAX //rethrow to let the next "catch" pick this up, skipping further "then" clauses throw err; }) .then(function(resultFromServer) { rec.price=999.99; //yay! success again //... },function() { //something went wrong });
Your promise chain is a mess, and your intent is far from clear, so here's an example, loosely based on your code, to demonstrate how you might make things a little easier to understand.
$.ajax({url: '/echo/json'}) //do one request .then(function(resultFromServer){ //yay! 1st request was successful return $.ajax({url: '/echo/json'}); //then do another request },function(err){ //something went wrong with the AJAX //rethrow to let the next "catch" pick this up, skipping further "then" clauses throw err; }) .then(function(resultFromServer) { rec.price=999.99; //yay! success again //... },function() { //something went wrong });
相关问答
更多-
jquery ajax错误回调(Jquery ajax error callback)[2021-08-17]
在http错误上调用错误回调,但是如果JSON解析响应失败 。 如果响应代码是200,那么可能会发生这种情况,但您仍然被引发至错误回调。 Error callback is called on http errors, but also if JSON parsing on the response fails. This is what's probably happening if response code is 200 but you still are thrown to error callba ... -
你的承诺链是一团糟,你的意图远非清晰,所以这是一个基于你的代码松散的例子,以展示你如何使事情更容易理解。 $.ajax({url: '/echo/json'}) //do one request .then(function(resultFromServer){ //yay! 1st request was successful return $.ajax({url: '/echo/json'}); //then do another request ...
-
我刚刚遇到一个类似的问题,相信我已经找到了一个解决方案。 由于设置对象与该ajax调用绑定,您可以简单地将索引器添加为自定义设置,然后您可以在成功回调中使用this设置访问: //preloader for images on gallery pages window.onload = function() { var urls = ["./img/party/","./img/wedding/","./img/wedding/tree/"]; setTimeout(function() ...
-
将ajax调用更改为: $.ajax( url: '/products/' + $('#delete_product').data('current_product').attr('product_id'), type: 'POST' data: _method: 'DELETE', dataType: "json" ).success -> $('#delete_product').data('current_product').fadeOut(200) .error -> ...
-
从讨论中,问题是当事件被触发时,处理程序尚未添加到dom中。 因此,确保事件处理程序在事件被触发前添加将解决问题 From the discussion, The problem is when the event is triggered the handler is not yet added to the dom. So making sure that the event handler is added before the event is fired will solve the probel ...
-
因此,您可以尝试使用错误和成功回调构建下面的ajax。 试试吧。 $.ajax({ dataType: "script", cache: false, url: 'Scripts/XXXX.min.js', error: function(returnval) { alert('error'); }, success: function (returnval) { a ...
-
如果服务器返回无法解析的无效XML,则可能会发生您正在观察的行为。 尝试返回保证有效XML的内容: header('Content-Type: text/xml'); // <-- Notice the Content-Type header casing echo '
'; exit(); 您xmlData contentType设置为application/x-www-form-urlencoded ,而您的数据参数称为xmlData假设为XML。 通过将processData参数设置为fa ... -
使用ajax的回调(Using callback for ajax)[2021-07-14]
您想要做的是使用Promise API已经可以实现的,是的,jQuery也支持它。 您只需要更改Login功能,如下所示: function User() { // .. other code truncated for brevity this.Login = function() { return $.ajax({ type: 'POST', url: 'your_url' // Note that `success` function has be ... -
我从来没有尝试过这个,但理论上它应该适用于jQuery 1.5+,因为如果你没有设置上下文, this是对传入选项的引用。 $.ajax({ ... ajax options ... // context: el <--- DO NOT USE THIS OPTION error: function() { $.ajax(this); } }); I've never tried this, but in theory it should work ...
-
您可以使用以下命令在任何给定时间初始化角度应用: angular.bootstrap(document, ['MyRandomApp']); 另见https://docs.angularjs.org/guide/bootstrap#manual-initialization you can initialize your angular app at any given time using: angular.bootstrap(document, ['MyRandomApp']); also see ...