Skip to content

Instantly share code, notes, and snippets.

@kimyongyeon
Created November 16, 2017 15:53
Show Gist options
  • Save kimyongyeon/cb96c30f10daf50bb465aaf47d79adad to your computer and use it in GitHub Desktop.
Save kimyongyeon/cb96c30f10daf50bb465aaf47d79adad to your computer and use it in GitHub Desktop.
<script type=text/javascript>
$(function() {
$('a#calculate').bind('click', function() {
$.getJSON($SCRIPT_ROOT + '/_add_numbers', {
a: $('input[name="a"]').val(),
b: $('input[name="b"]').val()
}, function(data) {
$("#result").text(data.result);
});
return false;
});
});
</script>
<h1>jQuery Example</h1>
<p><input type=text size=5 name=a> +
<input type=text size=5 name=b> =
<span id=result>?</span>
<p><a href=# id=calculate>calculate server side</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment