Skip to content

Instantly share code, notes, and snippets.

@siddharthkrish
Created December 13, 2017 10:09
Show Gist options
  • Save siddharthkrish/9db335f9d045ab1871bde79ea828bcb0 to your computer and use it in GitHub Desktop.
Save siddharthkrish/9db335f9d045ab1871bde79ea828bcb0 to your computer and use it in GitHub Desktop.
simple web page instrumentation
function notify( event ) {
$.post('https://requestb.in/1g52ujz1',
{ "button_name": $(this).attr('name'),
"position": $(this).attr('data-position') });
}
$(function(){
$( "button" ).on( "click", notify );
});
<html>
<head>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<link rel="stylesheet" href="style/common.css">
</head>
<body>
<p>
<button name="product#hsbc" data-position="1">HSBC</button><br/>
<button name="product#citi" data-position="2">CITI</button><br/>
<button name="product#dbs" data-position="3">DBS</button><br/>
</p>
</body>
<script src="js/common.js"></script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment