Ajax entire page - display only one div and retain CSS and other header material?

A client wants a merch shop on their site, and has set one up. I could iFrame in the whole page to the merch page, but frankly the merch site is an eyesore, and their site has a very particular feel to it. So I'm considering using an AJAX GET to grab the whole page, then javascript to display only the div with the merchandise in it. However, there are a lot of javascript includes (etc) on the merch site that I'd need to make sure are still present for the div to work correctly.

Any feeling on if this would work or not? Would the displayed div take its stylesheet and scripts from the AJAX'd page? Can I put the div in an iframe instead?


-------------Problems Reply------------

It sounds like an ugly solution. Isn't it better to do this serverside instead, for example let a PHP script read in the page and to whatever magic it takes to display it?

Using AJAX to load entire pages is ugly for a couple of reasons, including:

  • It breaks the URLs (can be worked around but requires extra work)
  • It's hard for search engines to crawl your site
  • It breaks some GUI elements in the browser, such as loading visualisations

looks like you can use jquery load function http://docs.jquery.com/Ajax/load

Category:javascript Views:1 Time:2010-01-10

Related post

  • Ajax refresh page content instead of div content 2010-11-16

    Is there a way to refresh the entire page content instead of just a div? --------------Solutions------------- what exactly do you want here? you can write 1 javascript line to refresh entire page window.location.reload() You can replace the content o

  • Reshuffling the display order of DIVs based on css media query? 2012-03-17

    Check out this page: http://new.brixwork.com/realtors/real-estate-website-features Below the big computer screen, the images and text blocks alternate in a staircase design.. on one div the image is on the right, on another, on the left. And there ar

  • TinyMCE not working in http request xhr ajax generated page 2011-11-06

    So i I have a page that contains links that call an httpRequest. The request calls a php file that grabs data from mysql and pre populates a form which is then returned to the browser/webpage. My problem is that when the page is returned to the brows

  • CakePHP ajax form return display continuously current page w/ missing controller 2011-05-12

    I am running an ajax submit in cakephp. It appears to be running, but the end result for the population of the assigned div is the page itself as opposed to the results set. And it also says the controller is missing which obviously is not true. Mode

  • Ajax: Load page content to div with select box 2010-02-19

    I'm trying to load page content into a div via Ajax when a select option is selected eg. I have a select box with 2 options the values are test.HTML and test1.HTML and under that I have a div and want the content from test.HTML and test1.HTML to load

  • When Web page is displayed in a div, Error: Unable to modify the parent container element before the child element is closed 2010-03-23

    A url is being displayed in a div as shown below <div id="ipage"> <? $url = "http://www.yahoo.com"; $file1 = fopen($url, "r"); $content = file_get_contents($url); echo $content; ?> </div> And I receive this error Webpage error detai

  • Stop the closing of an AJAX page displayed in fancybox? 2010-12-08

    How can I stop the closing of an AJAX page displayed in a fancybox? <a href="sample.php?name=name1&feedback=feedback1" id="feedback">feedback</a> fancybox code in jquery... $("#feedback").fancybox({ 'speedIn' : 600, 'speedOut' : 200,

  • display one particular div of a web page inside a newpage 2011-01-31

    I just want to display one particular div of a web page inside a newpage.How this can be done? --------------Solutions------------- create a webpage with only that particular div and use iframe imbed code. <iframe>my div</iframe>.

  • Ajax Working Vind But did not Display result in dive 2011-10-08

    I tried every thing which i using but ajax did not display the output in div BUT AJAX working fine.. is there any solution i could display result in div? Tested in Firebug its display the reponse in XHR but display in DIV Please solve me problem as s

  • Jquery AJAX request not displaying in the required div 2011-12-21

    I seem to be having an issue with JQUERY. I have an onclick event that calls a dialog box to open. On opening the dialog box it calls two functions both Jquery requests. Both functions send out a member ID and both return the required information how

  • Load div from another page within an AJAX loaded page 2012-01-24

    I'm using jQuery address to enable loading specific content from other pages and to change the URL in the address bar. I'm working on a little Social Network alike website, so I'm reading out the IDs of the posts table of my MySQL database via PHP. I

  • How can I "dim" the rest of the web page when displaying a notification DIV? 2012-02-26

    In my web app, I'm displaying a "notification" DIV. I would like to "dim" the rest of the page, so that the notification DIV stands out even more when displayed. Is there a reasonably easy way of doing so? This question is only concerned with visual

  • jquery ui datepicker in ajax loaded page 2009-08-16

    i've got a problem, im loading into a div a page with form, that have date. I want to get there datepicker, but when the page is loaded with ajax, jquery doesn't see mine input. I tried something like this: $('#birthdate').live('click', function() {

  • How to add a Facebook "Like" button to an AJAX driven page 2010-11-18

    I have trolled the net + Stackoverflow and have not found an adequate answer to this question and before I start the trial and error process of finding my own solution, I thought I would turn to the Stackoverflow braintrust and see if there was alrea

  • Using PHP mail in a loop forces user to wait until the page displays 2011-01-16

    I have a forum, where users can subscribe to a particular thread. When someone replies to the thread, the reply is added to the DB and an email alert is sent to all the subscribers before the success page is displayed. FYI - I am not using PHP's mail

  • Fancybox 'iframe' in AJAX loaded page 2012-01-06

    I've seen a few similar posts to my problem, but none that have helped me solve it yet. I have an index.php with a AJAX jQuery UI menu calling .html files brought in via AJAX when clicked. Within the .html files (4) I'm trying to use one fancybox via

  • asp.net mvc jquery Ajax partial page update issue 2012-02-08

    I am having a problem of a partial page update on Asp.net mvc 3 razor that I cannot get through I have this _LogOn partial view which has 2 text boxes Email and Password and a button connexion for login purpose: @using (Html.BeginForm()) { @Html.Vali

  • How do I get 'simple tip' jQuery to work on Ajax loaded page? 2012-03-18

    I'm using the 'simple tip' jQuery tooltip code on my site, which is working as it should on the index page but is not working on external pages I'm loading via AJAX. Please see the live example here. You will see it is working on the category icons,

  • Single-page display, multi-page print problem 2009-01-16

    A web page displays the following:- Bob Fred John However when the user (that would be me) prints the web page I want multiple repeats of this output with slight variations to be printed on separate pages :- Bob Fred John >page break here< Bob

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.340 (s). 11 q(s)