Skip to content

Instantly share code, notes, and snippets.

@troyscott
Created September 8, 2013 03:34
Show Gist options
  • Select an option

  • Save troyscott/6481623 to your computer and use it in GitHub Desktop.

Select an option

Save troyscott/6481623 to your computer and use it in GitHub Desktop.
jsonp request to php service.
<!DOCTYPE html>
<html>
<head>
<title>JSONP Example</title>
</head>
<body>
<script src="//code.jquery.com/jquery.js"></script>
<script>
$( document ).ready(function() {
console.log( "ready!" );
server = "http://localhost:8085";
service = "/service.php?callback=?";
request = server + service;
console.log(request);
$.getJSON(
request,
'name=Troy',
function(res){
alert('Your name is '+res.name);
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment