DEV Community

Zen
Zen

Posted on

2

How to Load Youtube with AJAX?

Like this:

$(".youtube").load("https://youtube.com")
Enter fullscreen mode Exit fullscreen mode

I got error: CORS

Top comments (4)

Collapse
 
jeexan2 profile image
Jysan Aziz

Will you please elaborate your use case please? You want to embed a youtube video in HTML page and loading the url with ajax? Or something else?

Collapse
 
mzaini30 profile image
Zen

I was edited my post.

Collapse
 
jeexan2 profile image
Jysan Aziz

Well I am assuming you have a class in html tag or div where you want to load any youtube video or page. You can use iframe or embed tag instead I guess!

Thread Thread
 
mzaini30 profile image
Zen

Thanks

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay