<?php
/**
* Template Name: FA
*/
get_header();
?>
<div id="Content">
	<div class="content_wrapper clearfix">
		<div class="sections_group">
			<div class="entry-content" itemprop="mainContentOfPage">
				<div class="section the_content has_content">
					<div class="section_wrapper">
						<div class="the_content_wrapper">
					<?php
					if( current_user_can('administrator') ) { // if adminitrator
						
					while ( have_posts() ) {
						
					?><h2>Frontaccounting</h2>
					<?php	
						the_post();
						$mfn_builder = new Mfn_Builder_Front( get_the_ID() );
						$mfn_builder->show();	
					}
					// $order_id = 2806;
					$order_id = $_GET["cn"];						
 
						
					}	 // end if administrator
					?>
							<div align="center">
							<a href="#" onClick="javascript:frontaccounintg();" >CLICK HERE</a>	
							<div id="serverResponse"></div>
							</div>

<script type="text/javascript">
function frontaccounintg(parameter1, parameter2, parameter3) {
	document.getElementById("serverResponse").innerHTML = "<img  style='text-align: center; width=200px;' src='<?php echo get_stylesheet_directory_uri();?>/img/loader1.gif' />";		


	const xhr = new XMLHttpRequest ();

	xhr.onload = function () {
	const serverResponse = document.getElementById("serverResponse");
	serverResponse.innerHTML = this.responseText;	
		
	}

	xhr.open("POST", "<?php echo get_stylesheet_directory_uri();?>/fa-do.php"); 
	xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr.send("name=Amer Saeed&message=how's it going");
}
</script>
							
							<br /><br /><br />
						</div>
					</div>
				</div>				
			</div>
		</div>
	</div>
</div>
<?php get_footer();