Get JavaScript JSON code in IE using jQuery

I have a line in a div element like this:

['39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78', '39.55,115.78'] 

I want to get this list object using jQuery in Internet Explorer. What can I do?

+4
source share
2 answers
 $.parseJSON($("#yourDiv").text()) 

However, JSON requires you to use double quotes, while your example uses single quotes. If you still want to parse it, you can replace them in your line:

 $.parseJSON($("#yourDiv").text().replace(/'/g, "\"")) 
+3
source

Read this ...

http://api.jquery.com/jQuery.parseJSON/

It looks like the string is not a well-formed jSON string.

EDIT: and this is ... http://www.json.org/example.html

+2
source

Source: https://habr.com/ru/post/1342399/


All Articles