Skip to content

Instantly share code, notes, and snippets.

@fajran fajran/template.html

Created Jun 28, 2012
What would you like to do?
<script type="text/javascript">
function compute() {
var a = $('#value_a')[0].value;
var b = $('#value_b')[0].value;
url: '/compute/?a=' + a + '&b=' + b,
success: function(data) {
a = <input type="text" name="a" id="value_a"/>
b = <input type="text" name="b" id="value_b"/>
a + b = <span id="result">...</span>
<button onclick="compute()">compute</button>
from django.http import HttpResponse
def compute(request):
a = int(request.GET['a'])
b = int(request.GET['b'])
c = a + b
return HttpResponse('%d + %d = %d' % (a, b, c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.