index.html
是:如何从控制台中显示的`object`中访问`status`?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
$(document).ready(function() {
var obj = $.get('tmp.html');
console.log(obj);
console.log('obj.status:'+obj.status);
});
</script>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
</body>
</html>
在console
输出是:
问题是我如何访问status
代码是200
,途中我做它表明这是不确定的,虽然它的200
被赋予它不会在当前状态下工作的原因是,你的要求完成之前访问它。如果您使用jQuery,为什么需要直接访问状态?该对象内置回调是有原因的。您应该使用成功,完成,总是或失败,或使用任何其他选项,而不是直接访问它。 –
一些信息在这里:http://stackoverflow.com/a/17547032/1336342 – green
请注意,蓝色的小'我' - 它的工具提示说,当您展开属性时,重新评估对象的行的东西 - 即它可能与记录的时刻不同。 –