Skip to content

Instantly share code, notes, and snippets.

@MikSDigital
Forked from appastair/jsonp.js
Last active August 29, 2015 14:16
Show Gist options
  • Save MikSDigital/fd1f4944bddba508a37c to your computer and use it in GitHub Desktop.
Save MikSDigital/fd1f4944bddba508a37c to your computer and use it in GitHub Desktop.
jQuery(function($){
$.ajax({
type: 'GET',
url: '//remote.org/jsonp.php',
data: {
field: 'value'
},
dataType: 'jsonp'
crossDomain: true,
}).done(function(response){
console.log(response);
}).fail(function(error){
console.log(error.statusText);
});
);
<?php
header('Content-type: application/x-javascript');
echo $_GET['callback']."([".json_encode($_GET)."])";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment