eozzy
eozzy

Reputation: 68650

JSONP post request

I'd like to use ProCSSor API (example query) but only if the query will happen as JSONP POST, to assure it will work in the front-end, but I'm not sure how.

I'd appreciate any help.

Thanks.

Upvotes: 0

Views: 467

Answers (1)

Upgradingdave
Upgradingdave

Reputation: 13056

Unfortunately, it looks like the procssor api only responds with json. It doesn't give the option to return with jsonp.

The example query link returns this:

{"css":"body\n{\n    margin: 0;\n  ... lots more stuff ... }

For JSONP, you'd need it to return something like this:

myFunction({"css":"body\n{\n    margin: 0;\n  ... lots more stuff ... })

Then, in your code, you could define myFunction() to do whatever you need to do with the json returned.

Perhaps you could email the folks at http://procssor.com and ask them to provide an api param like "jsonp". If they added that parameter, then you could call the api like this:

http://procssor.com/api?source=uri&css=<url_to_css>&indent_rules=1&indent_size=default&jsonp=myFunction

Upvotes: 1

Related Questions