PDA

View Full Version : TreeLoader - JSON Content-Type



andycramb
19 Jun 2009, 3:15 AM
Hi,

I am trying to set the content type in the TreeLoader class to JSON
I have tried this bit it still sends the content type as xml



var myTreeLoader= new Ext.tree.TreeLoader({
dataUrl : 'Service1.asmx/getTreeData'
, method: 'post'
//, jsonData: {surName: surName}
, jsonData: {}
, headers: { 'Content-Type': 'application/json;charset=utf-8' }
})


Does anyone know the way I need to approach this?
Any help is much appreciated

andycramb
19 Jun 2009, 5:11 AM
A few more searches later and Animal answers my question in another thread
http://extjs.com/forum/showthread.php?t=43153
I will attempt this approach



It's an option to Ext.Ajax.request

You could try extending the Ext TreeLoader an implement your own requestData method which would basically do what the Ext method does, but passing the parameters in jsonData instead of params You could set the headers there too, and that would be a neater solution.