Skip to content

Instantly share code, notes, and snippets.

@johnschimmel
Created November 26, 2013 21:39
Show Gist options
  • Save johnschimmel/7666728 to your computer and use it in GitHub Desktop.
Save johnschimmel/7666728 to your computer and use it in GitHub Desktop.
<div id="dynamicContent"></div>
<hr>
<button id="mrButton">Click me</button>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>
jQuery('#mrButton').click(function(e){
jQuery.ajax({
url : 'http://someurl.com/get_something',
type: 'GET',
success : function(data) {
console.log("SUCCESS!");
console.log(data);
jQuery("#dynamicContent").html(data);
},
error: function(err) {
console.warn("something went wrong");
console.warn(err);
}
}); // end of AJAX
}); //end of click event
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment