I have webmethod and jquery for display chart in pop up … so when i click on search button when there is data then working fine but when there is no data i want to display message “NO Data” in label … and also pop must not display when there is no data how i do this … check i try this code
<div id="divcontainer" style="display: none" align = "center">
<div id="container" class="cont_charts">
</div>
and for pop up
<script type="text/javascript" >
$(function () {
$("#divcontainer").dialog({
modal: true,
autoOpen: false,
title: "Chart",
width: 600,
height: 450
});
$("#search_data").click(function () {
$("#divcontainer").dialog('open');
});
});
</script>
when i try this
success: function (result) {
debugger;
var myData = JSON.parse(result.d);
debugger
console.log(JSON.parse(result.d));
debugger;
if (myData !== null && myData.length == 0) {
$("#Label4").text('No data found')
return;
}
strarr = result.d;
var myarr = strarr;
Drewchart(myarr); // here you could pass in myData and drop the JSON.parse in this method
},
this show not any error but this also not show any message. e.g. No data found
image without data
image with data