Creating a Blockchain wallet with Ajax gives CORS error

I'm trying to create a wallet on Blockchain using Ajax, but I get the error "Cross-Origin Request Blocked". My Ajax call:

$.ajax({
                    type: 'POST',
                    url: 'https://blockchain.info/api/v2/create_wallet',
                    data: "cors=true&email="+email+"&password="+password+"&api_code="+code,
                     dataType:'json',
crossDomain: true,
                     beforeSend:function(){


                      },
                    success: function (data) {

                    }
            });

When I send a message, I get an error message Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://blockchain.info/api/v2/create_wallet. This can be fixed by moving the resource to the same domain or enabling CORS.

In the blockchain, they say that some API calls are available with CORS headers if you add the cors = true parameter to the request

I tried everything, I tried to send this parameter as GET, as well as the POST parameter, I tried jsonp . I also tried with the header Access-Control-Allow-Origin *, but nothing works. Can anyone confirm if he managed to create a blockchain wallet using an Ajax call or they do not support CORS for this. Any help would be greatly appreciated.

thank

Hamza

+4
3

, , blockchain CORS API .

AJAX , CORS.

API- API- - https://blockchain.info/api/blockchain_wallet_api , CORS cors = true.

javascript . , .

+1

. , , $.ajax().

0
source

All Articles