Default State for Slider Button

Default State for Slider Button

I have created a simple slider that will toggle the state of my home heating system. The page uses ajax to call a php script that in turn writes a iether '1' or '0' to an html file. An arduino development board then reads this html file periodically to check the state and, if it differs from its localy stored state, toggles the home heating system using a relay. 

What i need to do now is to get the state of the slider in a newly loaded page to match the boolean in the html file. In a regular HMTL form containing a radial button, i can use the paramter checked ='checked' to indicate that a particular radial button must be checked when the page first loads. I imagine this parameter can be programmatically set. 

Is there an equivalent parameter i can use for my slider?

Thanks in advance!

My code below:

  1. <!DOCTYPE html> 
  2. <html> 
  3. <head> 
  4. <title>My Page</title> 
  5. <meta name="viewport" content="width=device-width, initial-scale=1"> 
  6. <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
  7. <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
  8. <script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
  9. </head> 

  10. <body>
  11.  
  12.     <script>
  13.     
  14.    
  15.    
  16.         $(function() {
  17.  
  18.    //$("#callAjax").click(function() {
  19.              //$( ".selector" ).bind( "change", function(event, ui) {
  20.              
  21.              $('#slider').change(function(event) {
  22.              //alert( $("#slider").val() );

  23.                 var theValue = $("#slider").val();
  24.  
  25.                 if(theValue.length > 0)
  26.                 {
  27.                     $.ajax({
  28.                       type: "POST",
  29.                       url: "callajax.php",
  30.                       data: ({heatstatus: theValue}),
  31.                       cache: false,
  32.                       dataType: "text",
  33.                       success: onSuccess
  34.                     });
  35.                 }
  36.             });
  37.  
  38.             $("#resultLog").ajaxError(function(event, request, settings, exception) {
  39.               $("#resultLog").html("Error Calling: " + settings.url + "<br />HTTP Code: " + request.status);
  40.             });
  41.  
  42.             function onSuccess(data)
  43.             {
  44.                 $("#resultLog").html("Result: " + data);
  45.             }
  46.  
  47.         });
  48.     </script>
  49.  
  50.     <div data-role="page" id="indexPage">
  51.         <div data-role="header" data-theme="b">
  52.             <h1>ThermoControl</h1>
  53.         </div>
  54.         <div data-role="content">
  55.         <div align="center">
  56.           <div data-role="fieldcontain">
  57. <label for="slider">The Heat is:</label>
  58. <select name="slider" id="slider" data-role="slider">
  59. <option value="0">Off</option>
  60. <option value="1">On</option>
  61. </select> 
  62. </div>

  63.             <div id="resultLog"></div>
  64.  </div>
  65. </body>
  66. </html>
  67.