Added check to see if jquery response must be parsed back to JSON (?).
Cleaned-up code.