Display NO Data when Ajax success is empty or null
I have a WebMethod, which is populating a JQuery DataTable with some
initial values. I have a drop down list, which calls the WebMethod and try
to populate it with different values. My problem, is if the JSON data is
null (or '') then i get JSON.parse: unexpected end of data.
Now, I can check the length of the object using if(msg.d.length !- '' {
build the table} ) However, if the length is null (''), then i never go
into the build table, and therefore cant present that there is no data /
no records.
How can I ensure that if the JSON string/object is null ('') that
DataTables still presents No Records found etc...?
No comments:
Post a Comment