AnsweredAssumed Answered

Alfresco.util.Ajax.request, text content and line breaks

Question asked by vincent-kali on May 14, 2018
Latest reply on May 15, 2018 by mikel_asla


I want to read text file content line by line from a YUI widget using an Ajax request.

Everything works fine except that line breaks are removed from server response. Code is added below.

Any advice to preserve line breaks in the text response ?



        url: Alfresco.constants.PROXY_URI + "slingshot/node/content/workspace/SpacesStore/xxxxxxxxxxxxxxxxx",
        successCallback: {
         fn: function _getFileContent_success(p_response) {
          var fileItems = (p_response.serverResponse.responseText).split("\r\n");

              .... process lines .......
         scope: this
        failureCallback: {
         fn: function _getFileContent_failure(p_response) {
          console.log("Error, unable to get file content: " + p_response);
         scope: this