WordPress 发布到 Jquery 移动框架
我想将我的 WordPress 帖子显示到 jquery 移动应用程序中...但到目前为止我还没有成功。我正在使用 jquery.post()
函数,但我的响应为空....
对所需网址的请求进展顺利,状态为 200 ok,但响应始终为空:( 尽管相同的 post 函数& url 在其他 php 页面中工作正常......
下面是我的代码
function get_Time(cityCode,date){
jQuery.post(
"http://test.local/time/",
{ city: cityCode, date:date},
function (data){jQuery('#print_time').html(data);}
);
}
function _get_Time(response)
{
alert("response:"+response);
var time = new Array();
time = response.split('|')
jQuery("#print_time").html(time[0]);
}
请给我一些解决方案,以将我的 WordPress 帖子(仅文本 + 链接)内容显示到我的 jquery 移动应用程序中......
I want to show my wordpress post into jquery mobile application... But so far i didnt got the success. I am using jquery.post()
function but my response comes empty....
Request to the desired url goes well , status comes 200 ok but response coming is always blank :( Although the same post function & url is working fine in other php pages....
below is my code
function get_Time(cityCode,date){
jQuery.post(
"http://test.local/time/",
{ city: cityCode, date:date},
function (data){jQuery('#print_time').html(data);}
);
}
function _get_Time(response)
{
alert("response:"+response);
var time = new Array();
time = response.split('|')
jQuery("#print_time").html(time[0]);
}
Please give me some solution for showing my wordpress post (only text + links) content into my jquery mobile applicaton....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定你要做什么。在我看来,就像您想通过 Ajax 检索某个 WordPress 帖子内容 + 附加信息一样,我认为最简单的方法如下:
编写一个自定义服务器端 PHP 脚本(这可能需要WordPress Slug 或 ID)
在此脚本中创建与数据库的连接,获取您想要的帖子内容并将它们作为文本或 JSON 返回到您的 JQuery 移动设备并使用 在此脚本中创建
它可能以如下方式工作(未测试):
当然,这只有在您有权访问服务器的情况下才有可能。如果您想从外部 WordPress 博客获取帖子内容,那么您应该考虑使用 RSS Feed。
以下文章展示了如何在外部 PHP 脚本中加载 WordPress 函数,这也可能有用:
I am not sure about what you are going to do. It seems to me, like you want to retrieve a certain WordPress post content + additional information via Ajax, I think the easiest way to do it is the following:
Write a custom server-side PHP-Script (which possibly takes a WordPress Slug or ID)
Create a connection to the database in this script, get the post contents you want to have and return these as text or JSON to your JQuery mobile and use it
It might work in a way like this (not tested):
This is only possible if you have access to the server, of course. If you want to get Post Content from an external WordPress Blog, then you should consider using the RSS Feed.
The following article shows how to load WordPress functions in an external PHP Script, which also might be useful: http://www.bloggingtips.com/2009/01/25/use-wordpress-functions-externally/