<html>
<head>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.9.1.min.js">
</script>
</head>
<body>
<script type="text/javascript">
function save(data) { // might want to use an external js file to cloak it
$.ajax({
url : "write.php",
type: "POST",
data : data,
success: function(serverResponse, textStatus, jqXHR) {
/* serverResponse -> response from write.php */
alert(serverResponse); // comment out, just to see how it works
},
error: function (jqXHR, textStatus, errorThrown) { }
});
}
</script>
<a href="javascript:void()" onclick="save({'user':'bhw','ip':'1.1.1.1'})">save this</a>
</body>
</html>