刷新页面后的document.ready()(使用不同的参数)

I have 'index.php' file, and the file contains JavaScript code like below

$( "#button1" ).mouseup(function() {
    temp = 1;
    vol = 2;
    if (temp != 0 && vol != 0){
        window.location.href = "index.php?temp=" + temp + "&vol=" + vol;
        return;
    }
});

Because of this code, the page now redirect to

http://localhost/index.php?temp=1&vol=2

I would like to check the url parameter in documnet.ready() function (or anywhere) because I have to use the temp & vol value in somewhere.

But the problem is document.ready() function does not execute. I also tried window.load() function..

Any idea?

Addition

$( window ).load(function() {
    var temp = getQueryVariable("temp");
    var vol = getQueryVariable("vol");
    if (temp != 0 && vol != 0){         
        $("#section1").css("display","block");      
        $("#section2").css("display","none");                   
    }
});

Basically, it will check the parameter named 'temp' and 'vol'. If those param exists, then decision on displaying blocks will be changed.

Note that I also tried with $(document).ready(function());

Addition2

function getQueryVariable(variable)
{
   var query = window.location.search.substring(1);
   var vars = query.split("&");
   for (var i=0;i<vars.length;i++) {
           var pair = vars[i].split("=");
           if(pair[0] == variable){return pair[1];}
   }
   return(false);
}

This function was copied from

https://css-tricks.com/snippets/javascript/get-url-variables/

Addition3

To explain the purpose of this whole code is..
1) User changes numerical value (temp and vol)
2) When hit 'submit', it calls $("#button1").mouseup(function()) JavaScript function above.
3) In the mouseup() function, I need to call PHP function with two param (temp and vol)

PHP does not allow me to use JavaScript value, so I am trying to reload the page with param, and would like to use the param value to call the PHP function. But, again, the problem is document.ready() or window.load() function is not executed.