Get the length of jQquery Ajax Response
Or convert your value (I guess it is an integer) to string:
tempId.toString().length
Do an if condition then convert it to string first, then count the length as needed.
success: function(response) {
if(response){
alert( (response + '').length );
}
}