字preSS PhoneGap的JSON不工作 [英] wordpress phonegap json doesnt work

查看:132
本文介绍了字preSS PhoneGap的JSON不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读的教程,我有一些问题的例子......我试图运行的例子,但我没有结果:

I'm reading a tutorial and I'm having some problems with the examples... I tried to run the examples but i dont have results:

app.html

<!DOCTYPE HTML>
<html>
<header>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/
jquery.min.js"></script>
<script>
function readSinglePost (url,target_div) {
var URL = url
jQuery.ajax({
    url: URL,
    dataType: 'json',
    success: function(data) {
        jQuery(target_div).html(data.post.content);
    }
});
}
jQuery(document).ready(function() {
jQuery("#title").html("<h1>Hello World</h1>");
var url = "http://www.recorramisiones.com.ar/api/get_post/? json=get_post&dev=1&p=934";
var target_div = "#contents";
readSinglePost(url, target_div);
});
</script>
</header>
<body>
<div id="main">
<div id="title"></div>
</div>
</body>
</html>

如果你试图测试这个网址: http://www.recorramisiones.com.ar/api/get_post/? JSON = get_post&安培;开发= 1和P = 934

if you try to test this url: http://www.recorramisiones.com.ar/api/get_post/? json=get_post&dev=1&p=934

正常工作。但是,当我测试app.html才出现的Hello World,仅此而已。任何想法?

works fine. But when i test app.html just appear "Hello World" and nothing more. Any idea?

推荐答案

试加内容ID这样的HTML:

Try add contents id like this to the html:

<div id="contents"></div>
</div>

这篇关于字preSS PhoneGap的JSON不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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