CRM-13551

 Currently this PR includes fix for point 'a)' mentioned in issue

    - the json object was not properly getting created (the response was in text format having json encoded data) , this object further on was being used as input for <code> .tokenInput() </code> function thus giving 'undefined' output . 

work in progress for point 'b)' of issue