function postwith (to, p) {    
    var myForm = document.createElement("form");    
    myForm.method="post";   
    myForm.action = to;    
    for (var k in p) {        
        var myInput = document.createElement("input");        
        myInput.setAttribute("name", k);        
        myInput.setAttribute("value", p[k]);        
        myForm.appendChild(myInput);    
    }    
    document.body.appendChild(myForm);    
    myForm.submit();    
    document.body.removeChild(myForm);
}
jQuery(document).ready(function() {   
    jQuery("#checkout").submit(function() {        
        jQuery.ajax({            
            type:'POST',            
            url:"/wp-content/plugins/wp-simple-paypal-form/processing.php",            
            data:jQuery(this).serialize(),            
            dataType: "json",            
            success: function(data){    
                //alert(data);
                postwith("https://www.paypal.com/us/cgi-bin/webscr",data);
            }    
        });        
        return false;    
    });
});
