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.
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
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.