Home > OS >  change return fetch directory
change return fetch directory

Time:04-01

I am trying to understand why I can't change return fetch directory to my /home direcotory rather tahn public_html :

 <script src="https://www.paypal.com/sdk/js?client-id=test&currency=USD"></script>

    <script>
        // Render the PayPal button into #paypal-button-container
        paypal.Buttons({

            // Call your server to set up the transaction
            createOrder: function(data, actions) {
                return fetch('/home/mysite/public_html/checkfetch.php, {
                    method: 'post'
                }).then(function(res) {
                    return res.json();
                }).then(function(orderData) {
                    return orderData.id;
                });
            },

It works when I make like above but what I need is not /home/mysite/public_html/checkfetch.php but /home/checkfetch.php

CodePudding user response:

Where is this hosted? Whatever is accessible in a web browser on that host (not a local file path) is what can be used for fetch. Establish valid route paths on your server, and use those. Nothing else.

public_html is an abnormal thing to have included in a web path. Normally such a folder indicates the filesystem root of where web paths begin from.

  • Related