2019-01-27 14:44
采纳率: 0%
浏览 164


i am trying paypal payment gatway in my website. on form submition its show error in console log

Access to XMLHttpRequest at '' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

i have alredy added header codes on files.

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Max-Age: 1000");
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, 
Origin, Cache-Control, Pragma, Authorization, Accept, Accept-Encoding");
header("Access-Control-Allow-Methods: PUT, POST, GET, OPTIONS, DELETE");

and also added in apache server.

Header set Access-Control-Allow-Origin "*"

but showing error. please help!

here is my originating script.

<form action="<?php echo $paypalURL; ?>" method="post">

                        <span>What service do yon need?</span><br>
                        <select name="item_name" id="service" class="select"> 
                            <option value="cleaning" data-id='5' data-no='1'>cleaning services at home</option>
                            <option value="parchase_grossery" data-id='5' data-no='2'>purchase of grossery</option>

                        <span>How many staff do you need?</span><br>
                        <select id="staff" class="select"> 
                            <option  data-id='1'>1</option>

                        <span>For how much Hour</span><br>
                        <select id="hour" class="select">
                            <option value="1">1 hour</option>
                            <option value="2">2 hour</option>

                         <span>You have to PAY:-</span> <br>
                         <input id="amount" type="text" name="amount" value="0" disabled><br>
                        <textarea>Enter address where you need these services</textarea><br>
                            <p>by clicking on button your are agree to our terms and conditions.</p><br>
                        <!-- Identify your business so that you can collect the payments. -->
                        <input type="hidden" name="business" value="<?php echo $paypalID; ?>">

                        <!-- Specify a Buy Now button. -->
                        <input type="hidden" name="cmd" value="_xclick">

                        <input type="hidden" name="item_number" value="">
                        <input type="hidden" name="currency_code" value="USD">

                        <!-- Specify URLs -->
                        <input type='hidden' name='cancel_return' value='http://localhost/paypal/cancel.php'>
                        <input type='hidden' name='return' value='http://localhost/paypal/success.php'>
                        <!-- Display the payment button. -->
                        <input type="image" name="submit" border="0"
                        src="" alt="PayPal - The safer, easier way to pay online">
                        <img alt="" border="0" width="1" height="1" src="" >

1条回答 默认 最新

相关推荐 更多相似问题