title: javascript assign variable value to checkbox status in html page
body: <p>I am very new to javascript, and this seems like a very simple problem but despite many similar posts none seem to point to a solution for me.</p>
  
  <p>I have the following code in a script of an html page:</p>
  
  <pre><code>$.get( "data.php", { getlocks: 1}, function( data ) { //Pull checkbox status from database (so it isn't lost on a page refresh)
      wl = data.split(" ");
      document.getElementById("lock369").checked = 1;
      document.getElementById("lock399").checked = 0;
      document.getElementById("lock935").checked = wl[2];
      document.getElementById("test1").value = wl[0];
      document.getElementById("test2").value = wl[1];
      document.getElementById("test3").value = wl[2];
  });
  </code></pre>
  
  <p>Where <code>"lock369"</code> and <code>"lock935"</code> are set to constants just for my sanity to ensure the page is loading properly. The problem is no matter how I setup <code>"lock935"</code> it comes out as checked even when <code>wl[2]</code> is zero. (I have text boxes <code>"test1"</code> - <code>"test3"</code> displaying the 3 elements of <code>wl</code> so I am sure they are getting the correct values from the database they're pulled from, via <code>data.php</code>).</p>
  
  <p>Originally I had all three checkboxes set to their respective elements of <code>wl</code> and the same issue occurs for all of them so it's not something funny with only <code>"lock935"</code>. I have also tried assigning the values of <code>wl</code> to individual variables and setting <code>document.getElementById("lockXXX").checked</code> equal to those variables, this didn't solve the issue. I also tried putting <code>wl[X]</code> in paranthesis, quotes, single quotes, etc. and nothing made a difference.</p>
  
  <p>As I mentioned I'm very new to js so if this is a simple negligence on my part just kindly yell at me for it and I'll correct my ways in the future :)</p>
  
  <p>Thanks!</p>