title: Object doesn't Support Property or Method 'replace'
body: <p>I am getting a strange error in my javascript code.</p>
  
  <p>Here is the code sample</p>
  
  <pre><code>function FetchData()
  {
  var selValue=$("select[id$=ddlComponents]").val()
      var param=$.param({ID:selValue});
  
      var method="proxy.aspx/GetComponentsValuesAgainstOilValue";
  
  $.ajax({
      type: "POST",
      url: method,
      data: param,
      contentType: "application/json",
      dataType: "json",
      success: function(response) {
  
      if (response.replace(/"/g, '') == '{d:[]}') 
      {
           response = eval('(' + response + ')').d;
       }
  
      },
      error: function(xhr,error,status)
      {   
          alert(error);
      }
    });
  </code></pre>
  
  <p>}</p>
  
  <p>It gives me an error at following line of code</p>
  
  <pre><code>if (response.replace(/"/g, '') == '{d:[]}') 
      {
           response = eval('(' + response + ')').d;
      }
  </code></pre>
  
  <p>object does not support property or function 'replace'. But replace function is working with string variables otherwise.</p>
  
  <p>My JQuery ver is 1.6.4</p>
  
  <p>Please help.</p>
  
  <p>Thanks
  vivek</p>