Last modified: 2011-09-10 05:17:55 UTC
It would be really awesome for a number of reasons if Semantic MediaWiki added support for the JSONP format, in addition to the existing JSON format. Creating jQuery applications using a Semantic MediaWiki as the backend would be very easy if JSONP were supported.
Wait a second, looking in the code for SMW_QP_JSONlink.php it looks like it does support JSONP // check whether a callback function is required if ( array_key_exists( 'callback', $this->m_params ) ) { $result = htmlspecialchars( $this->m_params['callback'] ) . "({\n\t" . $properties . ",\n\t" . $items . "\n})"; } else { $result = "{\n\t" . $properties . ",\n\t" . $items . "\n}"; } I think I just wasn't passing the parameter is callback, but instead jsoncallback. I'll test this and if needed update the documentation wiki to clarify.
I tested on my local wiki with: {{#ask:[[Modification date::+]]|?Modification date|?Has coordinates|format=json|callback=foo}} Works fine. Are you using some older version of SMW maybe?
Not an older version of SMW, but an older version of jQuery that was defaulting to "jsoncallback" instead of "callback". I haven't tried the new layout, but I expect it will work. However, I'm glad you posted that #ask query because I would not have thought to put the callback= in to the query. I would have assumed to put it in the URL after everything else.