Skip to content

Cookbook: jsonp

Eugene Lazutkin edited this page Nov 26, 2019 · 3 revisions

Just including io.jsonp activates it. See How to include for more details. See jsonp for the full documentation.

Make a JSON-P call

io.jsonp('/url').then(function (value) {
  console.log('Got:', value);
});

io.jsonp('/url', {q: 1}).then(function (value) {
  console.log('Got:', value);
});

Change a callback name

io.jsonp({
  url: '/url',
  callback: 'cb' // new callback name
}).then(function (value) {
  console.log('Got:', value);
});
Clone this wiki locally