$(document).ready(function(){
$('.btnPaypal').on('click', function(){
$.ajax({
url: '@(Url.Action("Action", "Controller"))',
type: 'post',
data: {
Value1: 'Value1',
Value2: 'Value2'
},
success: function (result) {
//for redirect
window.location = "url";
//new tab
window.open(URL,name,specs,replace);
}
});
});
});
make sure you have jquery referenced on the page and this is in a script tag at the bottom of your page. value1 and value2 are just examples of how you can send data back to the controller. Just make sure the post method you are pointing to on the controller has input parameters where the name matches exactly with what you are sending there. in the url parameter make sure to change action and controller to match your code and you should be good. Let me know if you have any questions.