05-14-2018 05:08 PM
Hi,
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 ?
<code>
Alfresco.util.Ajax.request({
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
}
});
</code>
Thanks.
05-15-2018 03:32 AM
Hi
When you say
.... process lines .......
Do you process more that one?
If yes then you got line breaks but you're spliting text on them with .split("\r\n")
After that code you are converting the response to an array of lines without line breaks
Regards,
Mikel
Explore our Alfresco products with the links below. Use labels to filter content by product module.