0

I am working on Asp.net MVC application which has function with a jQuery ajax call as below. I am getting a response as expected in data/result object.

It has multiple items in array.

How can check these items in if conditions. In my case i want check item at 0 index where RuleName = "License Denial"

I do not want to use for each loop, only wants to check first item in an array.

enter image description here

1
  • Did you try JSON.parse(data) ? Commented Oct 18, 2019 at 15:13

1 Answer 1

1

It looks like the "data" object is already an array. So, you can modify a condition in the following manner:

//if(data["items"][0]["RuleName"] == "License Denial") { ... }
if(data[0].RuleName === "License Denial") { ... }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.