[Dojo-interest] Writing a simple JSONP service
Doug McComber
doug.mccomber+dojo at gmail.com
Wed Jul 15 07:11:08 EDT 2009
> Date: Tue, 14 Jul 2009 12:43:53 -0400
> From: Peter E Higgins <dante at dojotoolkit.org>
> Subject: Re: [Dojo-interest] Writing a simple JSONP service
> To: dojo-interest at mail.dojotoolkit.org
> Message-ID: <4A5CB5C9.3090309 at dojotoolkit.org>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Doug McComber wrote:
>
> inline, lots cut:
>> callbackParamName: "jsonpcallback",
>>
>> $data = $_GET['data'];
>> echo 'jsonpcallback('.$contents.')';
>>
>> jsonpcallback is not defined
>> index.php?data=/somepath/somefile.json&jsonpcallback=dojo.io.script.jsonp_dojoIoScript1._jsonpCallback()()
>>
>>
> the "callbackParamName" is the key to the callback function. the name of
> the expected returned function is passed as this value. you want to:
>
> echo $_GET['jsonpcallback'] . "(" . $contents . ");";
>
> So, the value of the callback rather than the actual literal name
> "jsoncallback()"
>
> Hope this helps.
>
> Regards,
> Peter
Thanks to everyone for your replies and insight. Peter, thanks for
clarifying. I have it working now.
Regards,
Doug
More information about the Dojo-interest
mailing list