开发者

How do I make an XHRDataSource request to a Django server in YUI?

I'm using post, and the YUI documentation example code isn't working.

YAHOO.util.Event.addListener(window,"load",function()
{

    var columnDefs = 
    [ 
        {key:"url", sortable:true, resizeable:true}, 
        {key:"title", sortable:true, resizeable:true}, 
        {key:"count", sortable:true, resizeable:true} 
    ];

    this.dataSource = new YAHOO.util.DataSource("/getallsites/");
    this.dataSource.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
    this.dataSource.connMethodPost = true;
    this.dataSource.respons开发者_开发技巧eSchema = 
    {
        fields:["url","title","count"]    
    };

    this.myDataTable = new YAHOO.widget.DataTable("siteTable",columnDefs,this.dataSource,
        {initialRequest:"/getallsites/"});


});

The /getallsites/ returns a JSARRAY. I wanted to get the JSARRAY to work before I converted it to JSON. The Django server log isn't even recognizing a request to /getallsites/. Any ideas?

Thanks!


First, make sure you are including the Connection Manager utility on the page.

Second, the way you have it configured, the request will go to /getallsites//getallsites/, so try setting initialRequest to "".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜