0

I tried to load a page (of same domain) using ajax. But it's showing only the static html part. Styling and js actions are not there. How to load the exact page in a div using ajax?

Paul Shan
  • 614
  • 2
  • 8
  • 14
  • please share your code – Arun P Johny Sep 18 '13 at 08:42
  • This is exactly what an iframe is for, isn't it? A browser can't expect a html tag in a html tag, with all its dependencies in a head. – ppeterka Sep 18 '13 at 08:44
  • Reading about fancybox may help. – Grzegorz Sep 18 '13 at 08:46
  • CSS should work but any javascript won't run, you need to call a function when the ajax call is complete to start off any scripts – Adam Sep 18 '13 at 08:46
  • @ppeterka66 so, is it like, it's not possible to display a proper page inside a div? – Paul Shan Sep 18 '13 at 08:47
  • @Adam css is also not working :( – Paul Shan Sep 18 '13 at 08:48
  • Unless you do the plumbing required to it, with say jQuery, as in [this post](http://stackoverflow.com/questions/9963799/ajax-jquery-load-webpage-content-into-a-div-on-page-load), but I have not used this, so can't say for sure all the CSS and javascript will be in place... ([this post](http://stackoverflow.com/a/16193294/1667004) says CSS will be OK, but not JS) – ppeterka Sep 18 '13 at 08:49
  • Loading HTML page in the div tag will not work. Better you go for iframe (HTML 5 feature) and load the content of the iframe using ajax/jquery. – ajay_t Sep 18 '13 at 09:10
  • You'll need to show us some of your code, trying making a working example on http://jsfiddle.net/ – Adam Sep 18 '13 at 09:20
  • @Adam actually there are a lot of files... so not really able to show the code in jsfiddle. Can u gv me ur email id? I can mail u all the files – Paul Shan Sep 18 '13 at 09:28
  • @Optimus the problem is, I have a next button in the framework, on clicking the next page should be shown. If I use iframe, then ther's a little time gap between the click and the next iframe load. I don't want that – Paul Shan Sep 18 '13 at 09:32

0 Answers0