Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

javascript - display json_encode result to input tag in html

So I have this problem where I want to display the json result in input tag. I tried this Answer but the result is incorrect.

This is the json data:

["FAAS FRONT & BACK","NOA & TAX BILL"]

And this is the result:

Result

As you can see each character is in input box. How can I solve this?

The result should be like this:

This should be the result

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

On the JS, try use

data = JSON.parse(data);

So you can use it as an object instead.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...