psubbiah93@gmail.com

Wednesday, 2 December 2015

Change Page URL without Refreshing Page


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
    function ChangeUrl(page, url) {
        if (typeof (history.pushState) != "undefined") {
            var obj = { Page: page, Url: url };
            history.pushState(obj, obj.Page, obj.Url);
        } else {
            alert("Browser does not support HTML5.");
        }
    }
    $(function () {
        $("#button1").click(function () {
            ChangeUrl('Page1', 'Page1.htm');
        });
        $("#button2").click(function () {
            ChangeUrl('Page2', 'Page2.htm');
        });
        $("#button3").click(function () {
            ChangeUrl('Page3', 'Page3.htm');
        });
    });
</script>
<input type="button" value="Page1" id="button1" />
<input type="button" value="Page2" id="button2" />
<input type="button" value="Page3" id="button3" />
Unknown Web Developer

Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies

No comments:

Post a Comment