i wrote a web method that has string return value.this return value get form stored procedure .but when condition not be established the undefined value returned.i wrote the following code but it did not work
$.ajax(
{
type: "POST",
url: "WebForm1.aspx/confirm",
data: JSON.stringify({
username: username,
password: password, email: email,codemeli: codemeli}),
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function (ret) {
if (ret != "") {
$('#result').text(ret.d + " : " + "it is reserved "+ret.lenght); }
else { $('#result').text("the operation is successful"); }
},
error: function (x, e) {
$('#result').text(x.responseText);
}
}
);
ret.lenghtshould beret.d.lengthin yoursuccesscallback.