Javascript checkbox crazy if statement
<p>I've got a command.cgi that returns a website url, if the checkbox with id="simple" is checked then redirect the user to that page, if not, add the html formatted link to a container.
The problem is that it doesn't redirect the user to a html formatted link when the checkbox is checked and when it does, it redirects the user to a formatted html link, it's crazy.
Any solution? Thanks</p>

<pre><code>&lt;script type="text/javascript"&gt;
 $(document).ready(function() {
      $("#sudo").click(function(event){
          if ($("#simple").attr('checked')==1){
                    $.get("/cgi-bin/command.cgi",
                     { cmd: $("#cmd").val()},
                     function(data) {
        window.location.href=data;
                     });
                }else{
                    $.get("/cgi-bin/command.cgi",
                     { cmd: $("#cmd").val()},
                     function(data) {
                        $('#resultado p').prepend("&lt;a href=\"" + data + "\" target=\"_blank\"&gt;" + data + "&lt;/a&gt;&lt;br&gt;&lt;br&gt;");
                        $("#cmd").val('');
                        $("#cmd").focus();
                     });  
                }


      });
      $("#cmd").keyup(function(e){
        if(e.keyCode == 13){
            $("#sudo").click();
        }
    });
   });
&lt;/script&gt;
</code></pre>
