Dan*_*ani 0 javascript string compare
在jquery ajax函数中,我接受了服务器"true"或"false"字符串.然后我只知道结果但只是在条件下得到假.
 $.ajax({
    ...
        success: function(result) {
              if(result == "true"){   // false???????
                    alert('true');
                } else {
                    alert('false');
                }
             }
        })
    ...
$.ajax({
...
    success: function(result) {
          var result2 = String(result); 
          alert(result2);          // true
          alert(typeof result2);   // String
          alert(typeof "true");    // String
          if(result2 == "true"){   // false???????
                alert('true');
            } else {
                alert('false');
            }
         }
    })
...
...
有人可以帮帮我吗?
| 归档时间: | 
 | 
| 查看次数: | 10663 次 | 
| 最近记录: |