Browser doesn't distinguish a partial HTML got via AJAX and a full page Browser doesn't distinguish a partial HTML got via AJAX and a full page ajax ajax

Browser doesn't distinguish a partial HTML got via AJAX and a full page


Have your Ajax call use a different URL like /products/partial.


You should have a diferent url for partial results (i.e ?partial=yes or something like this...)

OR

you can get the whole page via ajax and extract just the part you want using jquery.load().

$("#productsContainerHolder").load("/my/products/url #productsContainer", { myParam: "beer", myParam2: "cold"});

$.load will call your server with a 'GET' method, retrieve all contents, extract the #productsContainer from there and insert on "#productsContainerHolder"

<div id="productsContainerHolder">    <div id="productsContainer>         ...    </div></div>


This article by Steve Luscher describes a similar case the problem was more intermittent than what you describe. The suggested solutions are:

  1. Cancel all of the AJAX requests at the time the form is submitted

  2. Use a different URL according to the response you expect

Steve went for #1 using cancel() on the ajax requests.

You don't mention what browsers you have used, there is a browser related question here