Created
October 8, 2012 04:30
-
-
Save trev/3850735 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="statics/js/jquery.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('#fire').click(function() { // This event fires when a button is clicked | |
var obj = $('#inputext').val(); | |
$.ajax({ // ajax call starts | |
url: '/activity/', // JQuery loads serverside | |
data: 'obj=' + obj, // Send value of the clicked button | |
dataType: 'json', // Choosing a JSON datatype | |
success: function(data) // Variable data contains the data we get from serverside | |
{ | |
$('#inputext').val('testing'); | |
} | |
}); | |
return false; // keeps the page from not refreshing | |
}); | |
}); | |
</script> | |
<textarea rows="10" cols="100" id="inputext"> | |
</textarea> | |
{% if obj %} | |
<p>{{ obj }}</p> | |
{% endif %} | |
</br> | |
<button class="fire" name="fire" id="fire" type="submit">Submit</button> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment