DEV Community

Zen
Zen

Posted on

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