$.ajax({
type:"POST",
url:"ceremony/awardsAction!getTheGold?awardsId="+awardsId,
data:"json",
success:function(obj){
if(obj!=null){ //问题出在这一行,逻辑问题
alert("not null");
}
}
});
here obj sometimes returns null, not null when I want the output to determine if obj is not equal to null.
I should ask how big God judge ?
even if it is null into ( judgment condition is not null to get into ) the following two will not work :
if (obj! = "null") tried ( if it returns null), it will enter .
if (obj! = null) tried ( if it returns null), it will enter .
------ Solution ---------------------------------------- ----
return in the end you do not know what it was changed to try this
if (obj && obj! = null && obj! = "null") {
alert ("not null");
}
------ For reference only --------------------------------- ------
is an object Object, but sometimes it is null.
------ For reference only --------------------- ------------------
or not, it is null which will enter judgment .
------ For reference only -------------------------------------- -
you see in the end is used firebug to debug what value is null or undefined
if (obj! = undefined && obj && obj! = null && obj! = "null") { ;
alert ("not null");
}
------ For reference only --------------------------------- ------
seen, is null, String type. But if (obj! = "null") {} is wrong ( as null also entered ) .
------ For reference only -------------------------------------- -
seen, is null, String type. But if (obj! = "null") {} is wrong ( as null also entered ) .
If a string is "null" main floor, see if there are spaces and line breaks , if you look at the value of the case is invisible behind the hidden \ r \ n or spaces
------ For reference only ---------------------------------------
seen, is null, String type. But if (obj! = "null") {} is wrong ( as null also entered ) .
If a string is "null" main floor, see if there are spaces and line breaks , if you look at the value of the case is invisible behind the hidden \ r \ n or spaces
If there are spaces or line breaks with $ trim (obj) = "null";.!
------ For reference only -------------- -------------------------
seen, is null, String type. But if (obj! = "null") {} is wrong ( as null also entered ) .
If a string is "null" main floor, see if there are spaces and line breaks , if you look at the value of the case is invisible behind the hidden \ r \ n or spaces
If there are spaces or line breaks with $ trim (obj) = "null".!;
trouble , or not ~
------ For reference only ---------------------------------------
seen, is null, String type. But if (obj! = "null") {} is wrong ( as null also entered ) .
If a string is "null" main floor, see if there are spaces and line breaks , if you look at the value of the case is invisible behind the hidden \ r \ n or spaces
If there are spaces or line breaks with $ trim (obj) = "null".!;
trouble , or not ~
Please firebug when his landlord see, I can not know
------ For reference only your business and data -------------- -------------------------
seen, is null, String type. But if (obj! = "null") {} is wrong ( as null also entered ) .
If a string is "null" main floor, see if there are spaces and line breaks , if you look at the value of the case is invisible behind the hidden \ r \ n or spaces
If there are spaces or line breaks with $ trim (obj) = "null".!;
trouble , or not ~
Please firebug when his landlord see, I can not know your business and data
------ For reference only ----- ----------------------------------
finally did get out , but then I get a compromise .
Solution:
I judge from backstage :
if(object!=null){
out.println(jsonObj);
}
If the object is not equal to null the output format json object , the object is equal to null if nothing is output, foreground Js will return an empty string "", foreground Js may determine:
......
success:function(obj){
if(obj != ""){
......
}
}
......
没有评论:
发表评论