0

callback function with ()

Hi,

I have just one question, why is not allowed to pass a callback function with parentheses ex. cbfunc()?

The console seems to support this, I can set the callback function to cbfunc() but when using the generated REST query (http://query.yahooapis.com/v1/public/yql?q=show%20tables&format=json&callback=cbfunc()) I get following error
CODE
cbfunc()({"error":{"lang":"en-US","description":"Invalid JSON callback parameter cbfunc()"}});


Cheers,
Micke

1 Reply
  • QUOTE (MikaelA @ May 3 2009, 10:49 AM) <{POST_SNAPBACK}>
    Hi,

    I have just one question, why is not allowed to pass a callback function with parentheses ex. cbfunc()?

    The console seems to support this, I can set the callback function to cbfunc() but when using the generated REST query (http://query.yahooapis.com/v1/public/yql?q=show%20tables&format=json&callback=cbfunc()) I get following error
    CODE
    cbfunc()({"error":{"lang":"en-US","description":"Invalid JSON callback parameter cbfunc()"}});


    Cheers,
    Micke


    We adhere to the rules for callback function names given at http://developer.yahoo.com/common/json.html#callbackparam
    "Callback function names may only use upper and lowercase alphabetic characters (A-Z, a-z), numbers (0-9), the period (.), the underscore (_), and brackets ([ and ]). Brackets must be URL-encoded; "

    So in your case "cbfunc" would be the ideal function name w/o the parens.
    Currently the console simply passes it to the backend which makes it appear that its accepting it but we do adhere to the spec (on the server side)

    -- Nagesh
    0

Recent Posts

in YQL