22416 Posts in 6945 Topics by 2750 members
|Go to End|
28 August 2010 at 3:40am
I'm trying to create a json object from a DataObject for a $.getJson request in jQuery.
If I pass the url "api/v1/Page/18/Retailers.json" to the jQuery script it returns data but not with JSON request header. I've enabled api access on both the page type and the related dataobject Retailers.
28 August 2010 at 4:17am
$json = Convert::array2json($dataobject->getAllFields( ));
28 August 2010 at 5:42am
Weird thing is when I use my code using the Java RESTClient suggested by the silverstripe book it returns a json object. However when I load it with jquery I can see the data in the response in Firebug but jquery doesn't parse it.
|Go to Top|