4 Answers
4

First: attempt to use undefined variable $data, you should have initialized it to an empty string before while loop: $data = '';, otherwise this can send PHP notice with the JSON response, depending on values of display_errors and error_reporting settings.

Second: as @shamittomar said, $data must be an array and json_encode() must be called only once for the whole array. For now, you're sending several JSON objects concatenated to a single string, which is wrong.

Third: value of the user function parameter in the JavaScript is actually an index of the data array, not a value, but even if user would be a value, it would be a JavaScript object with user and pass properties, not a string.

Have you tried validating the JSON?
jQuery is quite picky about it's JSON: it needs to validate correctly, no comments and the right content-type!
Try adding the following in your PHP to see if it helps (I always do this)