Allow for JSONP style requests #16

Open
moduscreate opened this Issue Mar 26, 2012 · 2 comments

2 participants

@moduscreate

Json.success is somewhat limited, as in it only allows requests for direct ajax requests not JSONP.

@moduscreate

A quick workaround is have your action do something like:

exports = function() {
var url = req.data.url,
data = doCurlRequest(url);

var response = Json.encode({ data : data });
if (req.data.callback) {
    response = req.data.callback + '(' + response + ')';
}

return response;
};

Have that action called via a jst

<%= getMp3File() %>

@mschwartz
Owner

Yikes.

The Json.success(), etc., methods should have that logic in them. An oversight on my part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment