Hi,
What I want to achieve. If the Url for certain emplyees does not exists then instead of displaying an error page I do not want to show the link itself for that employee. I have done it in 2 different ways and none of them are working. Please help. I have the entire code below. All of it is working except for the url part for ones with no html page that my link can connect to. Please help!!
function test(a,b) {
var Name = a.text();
$.ajax({
type: "POST",
url: "EmpServices.asmx/GetInfo",
data: '{ "fieldName": "' + a.attr("id") + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(results) {
// if (results.d.Url.length < 2)
// {
// $('#url').hide();
// }
if (results.d.EmpName.length > 1) {
var html = '<div style="width:25%;"><img src="' + results.d.image + '" /></div>'
+ '<div style="width:75%;">'
+ '<div><h3>' + results.d.EmpName + '</h3></div>'
+ '</div>';
//+ '<div id="url"><a href="' + results.d.Url+ '">Info></a></div>';
if (results.d.Url.length < 2)
{
html += '<div id="url"><a href="' + results.d.Url+ '">Info></a></div>';
}
$(Employee).html(html);
}
},
error: function() {
$(Employee).html('Error');
}
});
}