Jash Agrawal
Jash Agrawal

Reputation: 11

CALLING AN EXTERNAL HTML PAGE THROUGH InnerHTML (with out ajax or iframe)

//something like this index.html should be in like pop up

document.getElementById('pop_up_main').innerHTML = 'index.html';

Upvotes: 0

Views: 125

Answers (1)

Quentin
Quentin

Reputation: 944565

The innerHTML property takes a string of HTML.

It doesn't take a URL. It has no mechanisms for getting data from external sources (except insofar that you can set its value to some HTML which will do that: e.g. an iframe which you've already ruled out).

If you want to get content from a URL to assign to innerHTML then you need to make an HTTP request to do it. Unless you are doing that with server-side code and storing the data somewhere in the HTML document itself (e.g. in a data-* attribute) then you have to make that HTTP request with JavaScript … and that is the definition of Ajax (which you've ruled out).

Upvotes: 1

Related Questions