Комментарии:
What about CORB problem? (Cross-Origin Read Blocking)
Ответитьgood stuff
Looking for for a long time and equal channels, and here I found one
how fix this error > Missing required request header. Must specify one of: origin,x-requested-with
ОтветитьThanks - saved me :) In my case I needed to add two headers
Header Set Access-Control-Allow-Origin *
Header Set Access-Control-Allow-Headers *
Cheers
I'm trying to set global $_POST variables in php using fetch function in JS
This is my code :
fetch (url, {
method: 'POST' ,
body : 'var1=value1&var2=value2 '
}).then ( res => {
Console.log(res) ;
} ).catch ((error) => {
console.log(error);
} );
But I'm getting TypeError: NetworkError when attempting to fetch resource.
And when i tried to print out the post array in php it's displaying empty post array can you help me out please.
It would have been nice to see this solved without having use an asterisk... It feels like you just skirted round the problem you encountered with a solution that no one would use in a real application
ОтветитьBro , you help me to get rid of cors.
I had watched a lot
Cross origin * worked
❤❤❤❤
Thank you
For such a common issue, why is there no clear, concise, way to solve this? Why is it an issue to begin with for such a common feature of calling external apis?
ОтветитьUseful and well explained. Great job at leaving the unexpected glitches. Makes it way more realistic at what we all experience tweaking these settings. Thank you.
ОтветитьYou've got a very relaxing voice!
ОтветитьI have Tomcat 7.0.22 and when I add the filters, the server show me error 404. How I fix this ?Kind regards
ОтветитьThis topic has been confusing the heck out of me for quite some time.
I'm trying to do Ajax on the client side as much as possible.
Just regular html and js, so consuming an api ( hopefully without CORS errors )
And making the response from whatever api I'm calling look good style wise.
It's more difficult / there's much more to it than I first expected.
Thank you for the vids.
Thanks, brother.
Ответитьplease does this owork also for Xampp server???if yes,please where do i see the .htaccess file???
Ответитьhow am i supposed to write the code in magento 2 htcaaess. This code is not working for me
ОтветитьThank you! At last I met the comprehensive explanation.
ОтветитьThank you bro
ОтветитьThis was helpful. Even though i'm using Apache Tomcat, your clear explaination of the general guidelines of CORS is very helpful. It put me to the right direction.
ОтветитьAre you aware of the the following book: Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning Php, Mysql, Javascript, Css & Html5) 4th Edition?
If yes, what are your thoughts on it?
I ask because I have reached the chapter about Ajax and I tried the sample code from it but it isn't working and I experienced an error regarding CORS.
I am wondering if I should use the Ajax code samples from other books or should I search down the web for a solution to the CORS issue.
What do you think I should do?
setting wildcard as the origin, meaning there is no security, then why set it in the first place ?
ОтветитьThis does not help at all on the browser side. Plus, opening up the server to any request essentially does away with this type of security check; why bother with access checks at all.
I'm not down-voting because the title did not specifically mention browser solutions (though you demonstrated the error with your browser).
In most cases you when accessing an API you would not have access to the htaccess file due to attempting to connect to external APIs from other organisations.
Is there any way possible to work around this on the developers side and not from the API provider?