Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8253559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:55:07+00:00 2026-06-08T00:55:07+00:00

I have made a quick ajax driven page for pasting some text and running

  • 0

I have made a quick ajax driven page for pasting some text and running the yuicompressor. The output works just great, however, when I send the stdout back to my page, I have issues with the data cutting off at a < character. For example, when I run the compressor on this:

function Enum(values){
    for( var i = 0; i < values.length; ++i ){
        this[values[i]] = i;
    }
    return this;
}

I get a compressed version, no problem. Now, when I send this to my page like such:

exec(command, function(err, stdout, stderr) {
    console.log(stdout);
    res.writeHead(200, {'content-type': 'text/plain'});
    //res.write(decodeURIComponent(escape(stdout)));
    //res.write(qs.escape(stdout));
    res.write(stdout);
    res.end('\n');    
});

This always causes the data getting sent to be cut off at the < resulting in:

function Enum(a){for(var b=0;b

The console.log(stdout) displays perfectly, so it’s not until its sent to the client that it gets cut off.

When I attempted the encoding, I was able to get the entire output to my page all escaped out, but decoding it on the frontend resulted in the same issue of chopping it off.

Here’s the ajax call:

if(ready) {
    $.ajax('/get' + args + '/', {
        type: 'GET',
        dataType: 'text',
        success: function(data) { $('pre').html(data) },
        error: function() { console.log('error retrieving data') }    
    });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T00:55:10+00:00Added an answer on June 8, 2026 at 12:55 am

    It looks like your difficulty is that you’re telling jQuery to use a block of JavaScript as HTML, and it’s “cutting off” at the first HTML metacharacter, <. The content of a pre tag is still HTML, just whitespace is treated differently. Call $('pre').text(data) and you should be fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a quick questions.. I have made an outlook add-in for 2007 version and
I have made a quick fiddle: http://jsfiddle.net/tLLB4/ Ok, so the premise is, i'm hovering
I have made a quick fiddle to outline my problem: http://jsfiddle.net/mYdxw/ I'm trying to
I have made a quick Jsbin: http://jsbin.com/ujabew/edit#javascript,html,live What i'm trying to achieve is to
I have some ajax calls on the document of a site that display or
I have one question. I made quick search on the site, but don't found
i m new to Grails and using some Shiro security. I have made a
I have before created a quick Ajax Framework for one of my projects. It
I have made a jQuery/javascript that is loading a page into a div when
I have made a jQuery toggle for a menu that I had in mind.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.