views:

172

answers:

2

Hi,

I currently have a jQuery/ajax request which produces a recordset which appears in #contentDiv on my page. The user can then browse the results and view further details of an item. Once on the page for the item it the user hits back on their browser they return to the default page for my search without their generated search results.

The current jQuery code is:

$j.ajax({
    type: 'POST',
    url: '/availability/search',
    dataType: 'html',
    data: data,
    success: function(data) {
        $j('#col2AvailabilityContent').html(data);
        }
 });

Is it possible to pass the content of the results generated and passed to #colAvailabilityContent to a cache and draw these out when the back button is used.

Thanks

+1  A: 

Yes. The trick is to change your hash location.

For example, let's say your site is http://simnom.com/index.php.

Once your results appear, change your URL to simnom.com/index.php#x, then to index.php#results

Then, when the user hits back button, it will just go to index.php#x.

You can use the javascript:

if(location.hash == '#x') {
  $("#col2Availability").html(availabilitycontent);
}

And then keep $j.ajax()'s "data" stored as a global var "availabilitycontent".

Zachary Burt
actually would be '#x'
useless
A: 

there is example of recordset

http://java.pakcarid.com/Cpp.aspx?sub=387&ff=3068&topid=40&sls=25

lois