Last modified: 2011-09-10 05:17:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32826, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30826 - Add support for JSONP
Add support for JSONP
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-09 03:00 UTC by Jamie Thingelstad
Modified: 2011-09-10 05:17 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Jamie Thingelstad 2011-09-09 03:00:23 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.
Comment 1 Jamie Thingelstad 2011-09-09 12:39:19 UTC
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.
Comment 2 Jeroen De Dauw 2011-09-09 13:36:29 UTC
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?
Comment 3 Jamie Thingelstad 2011-09-10 05:17:55 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links