php - Validate Log in -


i have problem in phonegap application. seems if-else method not functioning here.

this code:

function onsuccess(position){   $("#login").click(function(evt){     var username = $("#username").val();   var password = $("#password").val();   var d = new date();   var date = d.getutcdate();   var hour = d.getutchours()+8;   var minutes = d.getutcminutes();   var secs = d.getutcseconds();   var year = d.getutcfullyear();   var mon = d.getutcmonth() + 1;   var day = d.getutcday();   var time = year + "-" + mon + "-" + date + " " + hour + ":" + minutes + ":" + secs;      var senddata = {"username": username, "password" : password, "time" : time};  $.ajax({     type: "post",     url: "http://192.168.254.107/webs/main/ajax/validatelogin.php",     data: senddata,     success: function(data) {         $("#info").html(data);         var returnmessage = data; // tried data.message here gives me "undefined"           if (returnmessage != "" && returnmessage != "invalid login!") {             alert(returnmessage);             localstorage.setitem("message", returnmessage);             document.location.href = "trackme.html";          } else {             alert(returnmessage);         }      }  });    }); 

}

what ever value of returnmessage is, method of if condition. if got "log in succesful!" message php file redirects trackme.html, if got "invalid login!", redirects trackme.html means if-else condition not functioning. thank help

please cross check data getting. there must space of white space. try trimming data: http://en.kioskea.net/faq/1786-javascript-trim-function


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -