Todd Freese wrote:
> I am fairly new to the whole world of returning data as JSON
> responses. I have a site that needs to get some data from 4D and
> return it as JSON data.
>
> I have the return data all formatted using the very cool a4d.json
> library, however, it seems that this data needs to be "wrapped" in
> some sort of callback syntax. Do I need to parse out something from
> the original request header to wrap my response with?
>
> My JSON response:
>
> {"folderNames":["Client Approval","Dailies","Design Tests","Released
> Spots"]}
>
> Here is what it should be:
>
> CPJSONPConnectionCallbacks.callback716({"folderNames":["Client
> Approval","Dailies","Design Tests","Released Spots"]})
>
> Where do I get the "CPJSONPConnectionCallbacks.callback716" part?
Todd,

I think that your framework is using JSONP instead of raw JSON. I don't
have access to the A4D JSON library but I doubt it handles it natively.

You might be able to wrap the response (which is just text), e.g.

$JSON := a4d.json.encode( ... ) `Off the top of my head, but you should
get the idea
$response := 'CPJSONPConnectionCallbacks.callback716\($JSON\)'
write ($response)

-- Brad Perkins

> Thanks!
>
> Todd Freese
> The Filmworkers Club
> _______________________________________________
> Active4D-dev mailing list
> [email protected]
> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
>

_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to