JQuery gets url on webpage but CSS is ignored

I am using jQuery on a webpage to get another webpage that I want to include in the div on the first page. This works fine, except that the other CSS styles of the webpage are ignored for some reason.

When I look at the return from the get call, I see that the returned var is an array in which there are two elements: one is the scripts from the selected page, and the other is HTML. I tried to add all of this or just the second half, but the styles just don't apply (I have text inside that should be white, but instead black).

Any explanations as to what might happen or how it should work are very welcome.

Thanks.

Mj

+4
source share
1 answer

Short answer: you cannot put the whole web page in a div. For this you need an iframe. If the response to the ajax request is an array with 2 elements, then the page you selected is a dynamic page that is encoded to return the array instead of just displaying html. Perhaps another page outputs json data that jQuery decodes into an array.

+2
source

All Articles