Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PRESTIGE2930's avatar

i have this code that makes a request to fetch an array from a laravel backend, on my local server, it runs smoothly but after i hosted it, i keep getting POST error "http://127.0.0.1:8000/retrieve net::ERR_BLOCKED_BY_CLIENT"

$.post("https://vgn.srgasaswsa.com", { // Retrieve CSRF token from the meta tag _token: document.querySelector( '#registrationForm [name="_token"]' ).value,

            // Send the value of the selected item as a parameter
            data: item.value,
        })
            .done((res) => {
                // Loop it as options in the corresponding Local government <select>
                $.map(res, (item) => {
                    $(local).append(
                        ` <li class="hover:bg-red-800 hover:text-white hover:font-semibold">
                        <label for="${item}" class="w-full h-fit relative" x-on:click="isFocus = false, message = '${item}'">
                            <input type="radio"
                                        name="${local.substring(1)}"
                                        id="${item}"
                                        value="${item}"
                                        class="absolute top-0 left-0 w-full h-fit opacity-0 cursor-pointer"
                            >
                            <p class="w-full h-fit py-2 text-[50px] lg:text-[1em] lg:text-base font-normal">${item}</p>
                        </label>
                    </li>`
                    );
                });
            })
            .fail((xhr, status, error) => {
                console.error(error);
            });

I changed the POST url affter hosting to the hosting url, but it still showing the same error,

this is my laravel cors 'paths' => ['api/*', 'sanctum/csrf-cookie'],

'allowed_methods' => ['*'],

'allowed_origins' => ['https://vgn.srgasaswsa.com'],

'allowed_origins_patterns' => [],

'allowed_headers' => ['*'],

'exposed_headers' => [],

'max_age' => 0,

'supports_credentials' => true,

0 likes
1 reply
MohamedTammam's avatar
Level 51

Mostly, your files have been built with the old URL. Try building again with the new one.

Please or to participate in this conversation.