Returning JSON response from Servlet to Javascript/JSP page

后端 未结 3 1958
小蘑菇
小蘑菇 2020-11-30 05:29

I think (actually I KNOW!) I\'m doing something wrong here I am trying to populate some values into HashMap and add each hasmap to a list which will be added to a JSON objec

3条回答
  •  感动是毒
    2020-11-30 06:03

    I think that what you want to do is turn the JSON string back into an object when it arrives back in your XMLHttpRequest - correct?

    If so, you need to eval the string to turn it into a JavaScript object - note that this can be unsafe as you're trusting that the JSON string isn't malicious and therefore executing it. Preferably you could use jQuery's parseJSON

提交回复
热议问题