如何让Firebug告诉我jquery的.load()返回什么错误? [英] How to get Firebug to tell me what error jquery's .load() is returning?

查看:137
本文介绍了如何让Firebug告诉我jquery的.load()返回什么错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在下面的代码中找出jquery的.load()方法返回的数据/错误(#content元素为空,因此我认为存在某种错误).

I'm trying to find out what data/error jquery's .load() method is returning in the following code (the #content element is blank so I assume there is some kind of error).

  1. 我在Firebug的哪里找到什么内容或错误.load()返回?
  2. 如何使用console.log至少查找返回的内容?
  1. Where do I find in Firebug what content or error .load() is returning?
  2. How can I use console.log to find out at least what content is being returned?


(来源: deviantsart.com )


(source: deviantsart.com)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript"
        src="http://www.google.com/jsapi"></script>
        <script type="text/javascript">
            google.load("jquery", "1.3.2");
            google.setOnLoadCallback(function() {
                $('#loadButton').click(loadDataFromExernalWebsite);
            });
            function loadDataFromExernalWebsite() {
                console.log("test");
                $('#content').load('http://www.tanguay.info/web/getdata/index.php?url=http://www.tanguay.info/knowsite/data.txt', function() {
       alert('Load was performed.');
    });
            }
        </script>
    </head>
<body>
    <p>Click the button to load content:</p>
    <p id="content"></p>
    <input id="loadButton" type="button" value="load content"/>
</body>
</html>

推荐答案

Firebug的'Net'标签应显示所有HTTP请求(包括来自其他域的任何请求)

The 'Net' tab of Firebug should show you all HTTP requests (including any from other domains)

这篇关于如何让Firebug告诉我jquery的.load()返回什么错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆