JSFiddle - React, Tailwind, and code Playground
HTML
<div class="div1">div 1</div>
<div class="div2">div 2</div>
<button class="update">Update</button>
JavaScript
$('.update').click(function(){
$.when(
$.ajax({
type: "GET",
url: "http://graph.facebook.com/?id=http://stackoverflow.com/",
success: function(option){
//do stuff
}
})).then(function( option ) {
//update html
$('.div1').html('URL: ' + option.id);
$('.div2').html('Shares: ' + option.shares);
});
});