Skip to content

Instantly share code, notes, and snippets.

@downgoon
Created May 16, 2017 06:42
Show Gist options
  • Save downgoon/3057814acf24538848943dacb7ae190e to your computer and use it in GitHub Desktop.
Save downgoon/3057814acf24538848943dacb7ae190e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
var person = {
boxid: '0001',
cname: 'hezi1'
}
$.ajax({
url: 'http://boxcloud.example.com:10010/bind',
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
success: function (data, status) {
alert("Data: " + data + "\nStatus: " + status);
},
data: JSON.stringify(person),
xhrFields:{withCredentials:true},
crossDomain:true
});
});
});
</script>
</head>
<body>
<button>bind</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment