Skip to content

Instantly share code, notes, and snippets.

@kmario23
Forked from chrisallick/Base64 JS Demo
Created August 13, 2014 11:07
Show Gist options
  • Save kmario23/66adb1922a245aa97576 to your computer and use it in GitHub Desktop.
Save kmario23/66adb1922a245aa97576 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Base64 Demo</title>
<meta charset="utf-8">
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' type='text/javascript'></script>
<script src='https://javascriptbase64.googlecode.com/files/base64.js' type='text/javascript'></script>
<script>
var data = {x:"cool"};
$(document).ready(function() {
$("#data").submit(function(event){
var e = Base64.encode(JSON.stringify(data));
var d = Base64.decode( e );
// test
console.log( data, e, d, JSON.parse( d ) );
//output
console.log( "http://dopenach.os/"+e );
return false;
});
});
</script>
</head>
<body>
<div id="wrapper">
<form id="data">
<input type="submit" />
</form>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment