I have existing jquery code to submit array 'array' as json var in a login process
var array1 = {
"command" : "login",
"username": $("#txt_username").val(),
"password": $("#txt_password").val(),
"remember": $('#chk_remember').is(':checked')
};
$.ajax({
url: 'functions.php',
data : {'array': array1},
dataType: 'json',
type: 'POST',
success: function(data) {
if (data.success == 1 ){
$('#result').html("You have been logged in.</br>You will be redirected to another page");
}
});
and at PHP
if (isset($_POST["array"])) {
$array = $_POST['array'];
switch ($array["command"]) {
case "login" :
if (DoLogin($array["username"], $array["password"]) == true) {
$success = 1;
}
else {
$success = 0;
}
$arr = array("success" => $success, "redirect" => 1);
echo json_encode($arr);
break;
}
how to deal with this login process from android?