0

So I have been trying to run the following Javascript function: (also using jquery)

function checkBijeenkomst(bid){
var value = false;
var login_accid = window.localStorage.getItem("id");
$.getJSON("firstapp/restservices/inschrijvingen/bid/" + bid, function(data){
    if (data != undefined){
    var acc_id = data[0].aid;
        if (login_accid == acc_id){
            console.log("true value");
            value = true;
        }
    }
});
return value;}

which btw gets this array as input from the JSON path:

[{"iid":2,"bid":46,"aid":1}]

but the function always returns the first given value. Even if the console logs ("true value").. How do I solve this? I am quite the newbie probably with this problem. But any advice is welcome.

Mastah
  • 63
  • 8

0 Answers0