jquery Ajax TypeError: Cannot use ‘in’ operator to search for ‘length’

The in operator only works on objects. You are using it on a string. Make sure your value is an object .

This is because wrong dataType while calling ajax ,

change dataType to ‘json’ will slove the problem ~ enjoy coding