Fix Bug 940406, ensure JSON is always returned for Ajax request to avoid parse errors

@erikrose r?