This project is archived and is in readonly mode.

#13 ✓invalid
Oskar Krawczyk

Request.JSONP's, onComplete() doesn't get fired

Reported by Oskar Krawczyk | March 10th, 2009 @ 10:42 AM | in Launch

Request.JSONP's, onComplete() doesn't get fired.

Please follow the link to see an example:

Check the console log.

Best, Oskar

Comments and changes to this ticket

  • Aaron Newton

    Aaron Newton March 10th, 2009 @ 05:28 PM

    • State changed from “new” to “invalid”

    This is invalid. For starters, the issue with flicker was fixed (see your other ticket) which was likely what made you specify in your data that the callback key was your other method (FlickerBadge.callback). By specifying in your data a different callback it means that JSONP's callback isn't called.

    The proper usage is to specify that the callBackKey is "jsoncallback" and let JSONP handle the response.

    See the new example in the user tests (/Tests/UserTests/Request/Request.JSONP), which basically is this:

    new Request.JSONP({
    	callBackKey: 'jsoncallback',
    	url: '',
    	onComplete: function(data){
    		new Element('div').adopt(
    			new Element('img', {
    				src: data.items[0].media.m
  • Oskar Krawczyk

    Oskar Krawczyk March 11th, 2009 @ 06:05 PM

    Fair enough.

    I think it would be a good idea to mention this in the Docs (?).

    Also, what I did to get the onComplete to fire was a simple'complete'); inside FlickerBadge.callback which seems to do the trick.

  • Aaron Newton

    Aaron Newton March 11th, 2009 @ 09:12 PM

    • Milestone set to Launch

    That's just not the intended usage at all. That would be like using Request to fetch content from the server which included javascript that fired Request's onComplete or something.

    Use JSONP to fetch things and attach your listener to the onComplete function. That's what it's for.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The MooTools Extensions

People watching this ticket

Referenced by