I’m new to Jquery. I have a code like this :
$.ajax({
url: "${createLink(controller :"
tasks ", action :"
holidayStatus ")}",
data: "userName=" + $("#user").find('option:selected').text() + "&date1=" + $("#datePicker").val() + "&date2=" + $("#datePicker2").val(),
cache: false,
success: function(html) {
$(".errors").append(html);
$(".errors").delay(1000).fadeIn('slow');
$("#createButton").delay(1000).fadeOut('slow');
})
This works as expected. In my success handler, I’m appending the html (which I got from server-side) to the .errors class. At the same time I’m hiding the button with id createButton.
But what I want is a way to find whether html in success handler contains any data (there are chances that html doesn’t have any content in it). If so I need to disable the createButton id if not I shouldn’t do anything.
How to proceed with it?
Live DEMO