I am not that good at ajax, javascript and so on.
I echoed from my PHP file 2 JSON arrays:
{key":"R\/EPspiig3jNffjjE6YWTsB+rsdlCjqnm1LExC\/vJXE=","nonce":"1aab51c5d8b23b7c110ae3f2a2d440bf0797750c85bd1602e8d57c357f34dab9"}
and
{"error":1,"message":"\u05d4\u05d0\u05d9\u05de\u05d9\u05d9\u05dc \u05e9\u05d4\u05d6\u05e0\u05ea \u05e9\u05d2\u05d5\u05d9 \u05d0\u05d5 \u05dc\u05d0 \u05ea\u05e7\u05d9\u05df \u05e0\u05e1\u05d4 \u05e9\u05d5\u05d1 ,\u05d0\u05e0\u05d0 \u05d4\u05db\u05e0\u05e1 \u05e1\u05d9\u05e1\u05de\u05d0"}
in my ajax i have this :
success: function(data) {
obj = JSON && JSON.parse(data) || $.parseJSON(data);
if(data[0].login == true)
{
window.location = "index.php";
}
else
{
$("#siimage").trigger("click");
$("form input:submit").effect("shake", {times:2}, 100);
$("#errorMessage").html(data[0].message);
$("#nonce").val(data[1].nonce);
$("#key").val(data[1].key);
}
if(data.cblocked == true)
{
$("#email").prop('disabled', true);
$("#password").prop('disabled', true);
$('input[type="submit"]').attr('disabled','disabled');
document.getElementById("Submit").value = 'נעול';
}
if(data.csrf == true)
{
$("#email").prop('disabled', true);
$("#password").prop('disabled', true);
$('input[type="submit"]').attr('disabled','disabled');
document.getElementById("Submit").value = 'נעול';
}
this the problem :
$("#nonce").val(data[1].nonce);
$("#key").val(data[1].key);
how i using that ,because i have 2 arrays anyway i using parse and handle 2 arrays this way ? like data[0] = array 1 and data[1] = array 2 ?