$(document).ready(function() { 
    var options = { 
        target:        '#requestsForm',   // target element(s) to be updated with server response 
	beforeSubmit:  showSpinner,  // pre-submit callback

	//url:   '<?php echo $this->webroot; ?>requests/add/',
	success:       showResponse  // post-submit callback 
       
    }; 
 
    // bind to the form's submit event 
    $('#RequestAddForm').submit(function() { 
        // inside event callbacks 'this' is the DOM element so we first 
        // wrap it in a jQuery object and then invoke ajaxSubmit 
	$(this).ajaxSubmit(options); 
 
        // !!! Important !!! 
        // always return false to prevent standard browser submit and page navigation 
        return false; 
    }); 
    function showResponse() {
	  $('#RequestAddForm').submit(function() { 
        // inside event callbacks 'this' is the DOM element so we first 
        // wrap it in a jQuery object and then invoke ajaxSubmit 
	$(this).ajaxSubmit(options); 
 
        // !!! Important !!! 
        // always return false to prevent standard browser submit and page navigation 
        return false; 
    });  
    }
	
	  function showSpinner() {
	  $("#formVal").hide();
        $("#wait_spinner").show();

    };
    
}); 




