I am trying to integrate atoms payment gateway in my MVC project. I have been getting this nasty error even after enabling CORS. So I thought perhaps it is the return url that is causing the issue. So I wrote a simple redirect to find out real cause return Redirect("https://google.com");
but i am still getting same error. What am I doing wrong?
public ActionResult TransferFund()
{
return Redirect("https://google.com");
}
Failed to load https://google.com/: Response to preflight request doesn't pass
access control check: No 'Access-Control-Allow-Origin' header is present on the requested
resource. Origin 'http://localhost:25850' is therefore not allowed
access. The response had HTTP status code 405.
I have followed This to redirect
EDIT
<script type="text/javascript">
$(document).ready(function () {
$('#btnatom').on('click', function () {
$.ajax({
type: 'POST',
url: "/AtomPayment/TransferFund",
data: {},
dataType: "text",
success: function (resultData) { alert("Save Complete") }
});
});
});
</script>
[HttpPost]
public ActionResult TransferFund()
{
return new RedirectResult("http://google.com");
string strURL, strClientCode, strClientCodeEncoded;
....
}