title: if else condition in jquery ajax response
body: <p>I have one Ajax function which is running properly.but i want when my Ajax response is </p>
  
  <pre><code>&lt;h3&gt;No Couriers found near by you.please select another location&lt;/h3&gt;
  </code></pre>
  
  <p>i want to display some error message else i want to display another map div in else condition.
  but every time when i hit Ajax only else condition is working..but when i alert response and see the output it shows this message when </p>
  
  <pre><code>&lt;h3&gt;No Couriers found near by you.please select another location&lt;/h3&gt;
  </code></pre>
  
  <p>but still it not comes in if condition..can anyone help me to do this....</p>
  
  <pre><code>&lt;script&gt;
  $('#weight0,#weight1,#weight2,#weight3').click(function() {
      var checked = $(this).is(':checked');
       if($(this).is(":checked")) { 
          $.ajax({
            type: "POST",
            url: '&lt;?php echo Router::url(array("controller" =&gt; "Orders","action" =&gt; "searchCourier")); ?&gt;',
            data: {
                frmlat: $("#PoolLatitude").val(),
                frmlong: $("#PoolLongitude").val(),
                mylocation: $("#PoolLocation").val()
            },
            dataType: "html",
            success: function(response) {  
            alert(response);
              if(response =="&lt;h3&gt;No Couriers found near by you.please select another location&lt;/h3&gt;"){
                alert(thanks);
              } else {
                  $('#map_canvas').css('display', 'none');//used to hide map after ajax success response.
                  $("#load_map").html(response); 
              }
            }, 
            complete: function() {
                $('.spinicon').hide();
            }
          });
      } else {
              $("#secretcode").val("");
          }    
  });
  &lt;/script&gt;
  </code></pre>