I have jQuery AJAX function that returns HTML after querying a database. Depending on the result of the query, the function will either return HTML co
//if(data="undefined"){
This is an assignment statement, not a comparison. Also, "undefined" is a string, it's a property. Checking it is like this: if (data === undefined) (no quotes, otherwise it's a string value)
If it's not defined, you may be returning an empty string. You could try checking for a falsy value like if (!data) as well