Solution 1 :

Try to store the data you need with Window.localStorage or sessionStorage and read from it.

Check this: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API

Problem :

I have a javascript that identifies a change by adding the word “. changed”. When I toggle between pages and go back to a previously shown page the word “. changed” is no longer there.

Is there a global version of this that will keep a set value. I can’t reload the page because (short version) it reads from a database that isn’t ready to be reloaded whilst changes are being made by the user.

This is the javascript

<script language="JavaScript" type="text/javascript">
function doAjax(that){
            $.ajax({
                type: 'post',
                url: "ajax_update_code.php",
                data: $(that).parent().serialize(),
                });
                var clicked = that,
                imageName = clicked.data("image");
                newValue = "B" + imageName;
                document.getElementById(newValue).innerHTML = ". Changed";
                clicked.removeClass("c_off").addClass("c_on");
                    $('input[type="submit"]').each(function() {
                        var self = $(this);
                            if (!clicked.is(self)) {
                                if (self.hasClass("c_on") && imageName == self.data("image"))
                                    self.removeClass("c_on").addClass("c_off");
                            }
                });
        } 
    });
</script>

Any help greatly appreciated.

You can see the code failing here. This version has two pages that toggle backwards and forwards when you press “other page”.

http://www.garryjones.se/test

Comments

Comment posted by garryjones.se/test

Thanks @Budi Salah. I tried but could not get the syntax right. What am I missing?

Comment posted by Budi Salah

Add

By

Leave a Reply

Your email address will not be published. Required fields are marked *