jQuery(document).ready(function($) {
	$('#side-sortables').each(function(){
		var id=$('#post_ID').val();
		if(id){
            //create the sidebar metabox
			var $box = $('<div class="postbox">');
	    	$box.append('<div class="handlediv"><br></div><h3 class="hndle"><span>PDF Export</span></h3>');
	    	var $inside_box = $('<div class="inside">');
            //place the loader icon in the metabox
	    	$inside_box.append('<p><span class="spinner" style="display: block;"></span><br/><br/></p>');
	    	$box.append($inside_box);
	    	$('#side-sortables').append($box);
			$.post(
			    ajax_object.ajax_url, 
			    {
			        'action': 'get_pdf_url',
			        'id':id
			    }, 
			    function(response){
			        $inside_box.html(response);
			    }
			);
		}
	});
});