jquery each报 Uncaught TypeError: Cannot use 'in' operator to search for错误

 

A recent project, use the $ .each () to iterate backstage pass over the json data. It occurs when traversing directly pass over the data  Uncaught TypeError: Can not use 'in  ' operator to search for the error.

Behind by the students discuss and seek information online to find out the reason, because we are backstage pass over the json data, but we have $ .each () traversal data to javascript object; so to have it transferred to a javascript object.

You can use  JSON.parse () ||  $ .parseJSON ()   This two way to convert.

 

===== Error Codes

 

 

===== proper code

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/268lwc/p/12127792.html