开发者

jQuery get URL include in webpage but CSS ignored

I'm using jQuery in a webpage to fetch another webpage that I want to include in a div in the 1st page. This works okay except that the other webpage's CSS styles are ignored for some reason.

When I look at the return from the get call, I see that the returned var seems to be an array that has 2 items in it - one is the scripts from the fetched page and the other is the HTML. I tried appending the whole thing or just the 2nd half, but the styles are just not applied (I have some text inside that is supposed to be white, but it's black instead).

Any explanatio开发者_如何学编程ns as to what could be going on or how this is supposed to work are greatly appreciated.

Thank you.

mj


Short answer is that you can't put an entire web page inside a div. For that, you need an iframe. If the response to the ajax request is an array with 2 items, then the page you fetched is a dynamic page that's coded to return an array instead of just outputting html. Perhaps the other page is outputting json data which jQuery is decoding into an array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜