-2

I have below data received from Ajax call as response

{d: "ADIDAS,NIKE,PUMA, METRONAUT }

Now, i need to convert this into array as shown below

["ADIDAS","NIKE","PUMA","METRONAUT"]

How can i do this using jquery/javascript?

2

2 Answers 2

1

 let k={d: "ADIDAS,NIKE,PUMA, METRONAUT" }
    
    let s=k.d.split(",");
    console.log(s)

Try this

Sign up to request clarification or add additional context in comments.

Comments

1

This should do it.

var responseObject = { d: "ADIDAS,NIKE,PUMA, METRONAUT" };
var resultArray = responseObject.d.split(",");
    
console.log(resultArray);

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.