Tag Archives: jquery each

[Solved] Jquery each error: Uncaught TypeError: Cannot use ‘in’ operator to search for

Recently, when I was working on a project, I used $. Each() to traverse the JSON data passed from the background. Uncaught type error: cannot use ‘in’ operator to search for this error occurs when directly traversing the passed data

Later, we found out the reason through the students’ discussion and online query, because what we passed from the background is JSON data, but the data we traversed by $. Each() is JavaScript objects; So I’m going to pass it to a JavaScript object

You can use JSON.Parse() | $.Parsejson() to convert

=====Error code

=====Correct code