I want to check via js/jquery if a value exits in a json array:
[{"pathway_action_fk":"1"},{"pathway_action_fk":"2"},{"pathway_action_fk":"4"}]
I have tried without success:
$.ajax({
type: "POST",
url: "scripts/get_actions_allowed.php",
data: 'pathway=' + pathway_pk,
dataType: "json",
success: function(returnedData) {
if ($.inArray('1', returnedData)){
$('#script').addClass('active');
}...
If I put in after success:
alert(returnedData);
I get[object Object],[object Object] which is the correct number of objects that should be returned. Removing json as dataType shows the correct values...