I get a strange error in my javascript code.
Here is a sample 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);
}
});
}
It gives me an error on the next line of code
if (response.replace(/"/g, '') == '{d:[]}')
{
response = eval('(' + response + ')').d;
}
An objectdoes not support the property or function "replace". But instead, the replace function works with string variables.
My jQuery ver 1.6.4
Please, help.
Thanks Vivek
source
share