尝试在jQuery中使用JSON [英] Trying to use JSON with jQuery

查看:85
本文介绍了尝试在jQuery中使用JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jQuery 1.4.1来使json工作,但是我得到了一个空对象.

I'm trying to get json working using jQuery 1.4.1 but I'm getting a null object.

这是一个不工作代码的示例:(使用$ .ajax并带有成功:")

Here's an example of not working code: (using $.ajax which has the 'success:' )

$.ajax({
    url: 'http://isohunt.com/js/json.php',
    dataType: 'json',
    success: function(data) {
        alert('Worked');
        alert(data);
    }
});

此代码有什么问题?

预先感谢

推荐答案

您无法对跨域进行Ajax.您必须在域内创建代理.检查 http://www.google.com/search?q=ajax+cross +网域

You cannot ajax cross domain. You have to make proxy instead, inside your domain. Check http://www.google.com/search?q=ajax+cross+domain

这篇关于尝试在jQuery中使用JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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