Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
HTML
<script type="application/javascript">
    $(document).ready(function () {
        $('#btnUsingjQuery').click(function () {
            $.ajax({
                dataType: "POST",
                url: "http://paypal.com/payment/widget?apikey=XXXXX&country=my&returnurl=http://www.google.com",
                dataType: 'jsonp',
                success: function (results) {
                    window.location = 'http://paypal.com/payment/widget?apikey=XXXX&country=gb&returnurl=http://www.google.com';
                },
                error: function () {
                    window.location.replace("http://www.google.com");
                }

            });
        });
    });
    </script>


i'm trying to lead end user to payment page to make payment,but getting error :

Refused to execute script because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Solution, I got from google is change <script> to <script type="application/javascript"> and dataType: 'json' to dataType: 'jsonp'..but still not working..any ideas why?

What I have tried:

i'm trying to lead end user to payment page to make payment,but getting error :

Refused to execute script because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Solution, I got from google is change <script> to <script type="application/javascript"> and dataType: 'json' to dataType: 'jsonp'..but still not working..any ideas why?
Posted
Updated 5-Dec-16 19:16pm
Comments
Homero Rivera 5-Dec-16 0:05am    
dataType: "POST", ????
F-ES Sitecore 5-Dec-16 3:59am    
You have "dataType" twice.

1 solution

Try this one and check just changed type:'POST' in ajax request.
JavaScript
<script type="application/javascript">
    $(document).ready(function () {
        $('#btnUsingjQuery').click(function () {
            $.ajax({
                type: 'POST',  
                url: "http://paypal.com/payment/widget?apikey=XXXXX&country=my&returnurl=http://www.google.com",
                dataType: 'jsonp',
                success: function (results) {
                    window.location = 'http://paypal.com/payment/widget?apikey=XXXX&country=gb&returnurl=http://www.google.com';
                },
                error: function () {
                    window.location.replace("http://www.google.com");
                }
 
            });
        });
    });
    </script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900