<script type="text/javascript">
function abc() {
var name = $("#name").val();
$.get("/Game/CheckName", { plName: name }, function (data) {
alert(data); // here data = true
if (data == true) { // i tried so (if (data)) but it didn't work too
window.location.href = '@Url.Action("List", "Game")';
} else {
alert("Name is already use!");
}
});
}
在此代码中,(if (data == true))
值始终 = false。为什么?我怎样才能改变它?