title: how to put if condition in jquery's append function
body: <p>i have trapped in a jquery function, all i want is to append some divs using jquery's append function, but the problem is that i want to put some if conditions in this function, </p>
  
  <p>here is my working code without condition</p>
  
  <pre><code>$( "#some-div-container" ).append( 
                                    "&lt;div&gt;name 1" +
                                        "&lt;a href=\"#\"&gt;" +
                                             "&lt;div id=\"add\"&gt;Add&lt;/div&gt;" +
                                        "&lt;/a&gt;" +
                                        "&lt;div&gt;Available&lt;/div&gt;" +
                                    "&lt;/div&gt;"
                                  );
  </code></pre>
  
  <p>i am using jquery's ajax function having some json response, so i want just that, let say if(response == 1) then execute the code inside it, i am trying using condition, </p>
  
  <pre><code> $( "#some-div-container" ).append( 
                                    "&lt;div&gt;name 1"
                                    if(response == 1) {    
                                       +"&lt;a href=\"#\"&gt;" +
                                             "&lt;div id=\"add\"&gt;Add&lt;/div&gt;" +
                                        "&lt;/a&gt;"
                                    }
                                        + "&lt;div&gt;Available&lt;/div&gt;" +
                                    "&lt;/div&gt;"
                                  );
  </code></pre>
  
  <p>is it possible?
  Any help will be appreciated, an error occured when i put this condition "my some other javascript function is not defined", works perfect without condition</p>