WordPress jqgrid 问题
我的脚本从我的方法返回此 xml 数据:
<?xml version='1.0' encoding='utf-8'?><rows><page>1</page><total>1</total><records>1</records><row id='12'><cell>tyutyu</cell></row><row id='11'><cell>yutyyut</cell></row><row id='10'><cell>sdfsdsdf</cell></row><row id='9'><cell>taepsh</cell></row><row id='8'><cell>ffhfghfgfg</cell></row><row id='7'><cell>ytutytytyu</cell></row><row id='6'><cell>yuyttyuty</cell></row><row id='5'><cell>Jaggu Jamfad </cell></row></rows>
但是,当我在 Firebug 中看到响应时,我看到 HTML 与我的 xml 数据混合在一起。
我正在使用 WP MVC,它是 Wordpress 的 MVC 框架。我怎样才能解决这个问题并告诉 WordPress 只发送 xml 数据。目前,它正在发送 HTML 以及菜单和各种内容,可能是因为我的操作方法位于“管理”部分。
好的。现在这是我的 html:
<script type="text/javascript">
$(document).ready(function(){
$("#list").jqGrid({
url:'someurl.php',
datatype: 'xml',
mtype: 'POST',
colNames:['ID'],
colModel :[
{name:'ID', index:'ID', width:655},
],
pager: '#pager',
rowNum:10,
rowList:[10,20,30],
sortname: 'ID',
sortorder: 'desc',
viewrecords: true,
caption: 'Beats'
});
});
</script>
<table id="list"><tr><td/></tr></table>
<div id="pager"></div>
有人能发现错误吗?我在这个问题上浪费了整整1个小时。
提前致谢 :)
My script returns this xml data from my method:
<?xml version='1.0' encoding='utf-8'?><rows><page>1</page><total>1</total><records>1</records><row id='12'><cell>tyutyu</cell></row><row id='11'><cell>yutyyut</cell></row><row id='10'><cell>sdfsdsdf</cell></row><row id='9'><cell>taepsh</cell></row><row id='8'><cell>ffhfghfgfg</cell></row><row id='7'><cell>ytutytytyu</cell></row><row id='6'><cell>yuyttyuty</cell></row><row id='5'><cell>Jaggu Jamfad </cell></row></rows>
However, when I see in response in Firebug I see HTML mixed up with my xml data.
I am using WP MVC which is a MVC framework for Wordpress. How can I solve this issue and tell wordpress to only send just xml data. Currently it is sending HTML along with menus and all sort of stuff probably because my action method is in Admin section.
OK. Now here is my html:
<script type="text/javascript">
$(document).ready(function(){
$("#list").jqGrid({
url:'someurl.php',
datatype: 'xml',
mtype: 'POST',
colNames:['ID'],
colModel :[
{name:'ID', index:'ID', width:655},
],
pager: '#pager',
rowNum:10,
rowList:[10,20,30],
sortname: 'ID',
sortorder: 'desc',
viewrecords: true,
caption: 'Beats'
});
});
</script>
<table id="list"><tr><td/></tr></table>
<div id="pager"></div>
Canybody spot the mistake? I have wasted complete 1 hour behind this issue.
Thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想确认您的问题只是“someurl.php”返回 HTML 数据而不是纯 XML 数据。我自己不使用 WP MVC,因此无法在该主题上为您提供帮助。
如果您的服务器返回纯 XML,您可以从演示中看到数据,网格将显示预期的包含。
I want just confirm you that your problem is only that the 'someurl.php' returns the HTML data instead of pure XML data. I don't use WP MVC myself so can't help you in the subject.
How you can see from the demo, if your server would return pure XML data, the grid will do display the expected contain.