Understanding CORS AJAX fetch problems

Understanding CORS AJAX fetch problems

43,716 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@arazmammadov9276
@arazmammadov9276 - 25.08.2021 15:17

What about CORB problem? (Cross-Origin Read Blocking)

Ответить
@yinonelbaz5309
@yinonelbaz5309 - 02.05.2021 22:07

good stuff
Looking for for a long time and equal channels, and here I found one

Ответить
@bryanferry6409
@bryanferry6409 - 25.03.2021 22:10

how fix this error > Missing required request header. Must specify one of: origin,x-requested-with

Ответить
@bojandjulbic3080
@bojandjulbic3080 - 16.02.2021 23:43

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

Ответить
@aadil4236
@aadil4236 - 12.10.2020 14:29

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.

Ответить
@Defrost2157
@Defrost2157 - 14.07.2020 14:21

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

Ответить
@vigneshreddy9262
@vigneshreddy9262 - 12.06.2020 06:25

Bro , you help me to get rid of cors.
I had watched a lot
Cross origin * worked
❤❤❤❤
Thank you

Ответить
@TayoEXE
@TayoEXE - 12.06.2020 00:32

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?

Ответить
@thedartside1050
@thedartside1050 - 10.06.2020 23:46

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.

Ответить
@faruzzy
@faruzzy - 28.04.2020 17:20

You've got a very relaxing voice!

Ответить
@arturoespinosa3571
@arturoespinosa3571 - 11.03.2020 22:29

I have Tomcat 7.0.22 and when I add the filters, the server show me error 404. How I fix this ?Kind regards

Ответить
@FordExplorer-rm6ew
@FordExplorer-rm6ew - 11.12.2019 21:25

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.

Ответить
@edrismalya7621
@edrismalya7621 - 03.10.2019 14:25

Thanks, brother.

Ответить
@obentabiayuk4780
@obentabiayuk4780 - 02.10.2019 12:24

please does this owork also for Xampp server???if yes,please where do i see the .htaccess file???

Ответить
@naveeshkumar8383
@naveeshkumar8383 - 22.08.2019 15:43

how am i supposed to write the code in magento 2 htcaaess. This code is not working for me

Ответить
@Sergey-mr6be
@Sergey-mr6be - 08.08.2019 23:20

Thank you! At last I met the comprehensive explanation.

Ответить
@firdovsirustemov3472
@firdovsirustemov3472 - 24.07.2019 19:33

Thank you bro

Ответить
@jandeman8410
@jandeman8410 - 11.07.2019 19:15

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.

Ответить
@senju31
@senju31 - 15.03.2019 23:19

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?

Ответить
@arLevi
@arLevi - 29.11.2018 18:12

setting wildcard as the origin, meaning there is no security, then why set it in the first place ?

Ответить
@iPadApprentice
@iPadApprentice - 09.11.2018 22:15

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).

Ответить
@shamtheartist6831
@shamtheartist6831 - 08.11.2018 13:10

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?

Ответить