As @roasted stated, it is difficult to fully figure this out without code, but this should resolve at least part of the issue for you:
First, a note: As of jQuery 1.8 the success
callback method is deprecated:
The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks are deprecated as of jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.
Here is a solution to some of your problem. It is likely not the solution to all of it, as, if you are getting a blank value from your sql query, there is probably a problem with your query, your database, or both. However, this will provide a 'solution' to the front-end part of your problem -> (This is predicated on the assumption that your php file builds the relevant <option>
elements for your <select>
element):
$.cityselect = function(){
var td= $('#countryselect').val();
$.ajax({
type: "POST",
url: "action.php",
data: {'countrytd':td},
}).done(function(data){
// better not to use 'e' for this variable (can be confusing)
if($(data).html().replace(/\s/g,'').length){
//There are a number of ways to check this
//(depends on what you are expecting).
// The example I used will also catch blank spaces
$('#cityselect').html(data);
}
})
};