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

  • SEARCH
  • Home
  • 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 8455001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:10:25+00:00 2026-06-10T12:10:25+00:00

Most MVC frameworks support escaping of server data, before putting them on the web

  • 0

Most MVC frameworks support escaping of server data, before putting them on the web page. I couldn’t find any option in jQuery‘s ajax method to do the same. In fact, I couldn’t even find a native jQuery function to escape strings for proper display on the page (Putting the contents in a div, and calling .html() on it, is not guaranteed to preserve white space). Why is it that this function is not available in jQuery, but you can find it in underscore and prototype libraries ?

  • 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-10T12:10:27+00:00Added an answer on June 10, 2026 at 12:10 pm

    I think you mean you want to prevent HTML markup (e.g. <br/>, <a>, &) from being treated as HTML markup: you just want to display it straight to the user. This helps to prevent attacks like XSS (cross-site scripting).

    This is actually very easy with jQuery, but it isn’t the same as escaping. It’s just using the text method, which means the content is treated as textual content, not as markup.

    $.ajax({
        url: 'someurl',
        success: function(data) {
            $('#yourElement').text(data);
        }
    });
    

    It is different working client-side to server-side. Working server-side, you are dealing with markup, which needs to be escaped to stop the parser treating content that should be text as markup. On the client-side, the markup is already parsed, so all you need is to tell the browser “this is text content”. This can be done in a variety of ways (innerText, document.createTextNode, or even document.createCDATASection); jQuery’s data method does this for you.

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

Sidebar

Related Questions

Most web frameworks are still using the traditional action based MVC model. A controller
I'm using ASP.NET, but I'm sure this pertains to any (or most) MVC frameworks.
Most of my company's web programming background is PHP, so ASP.NET MVC was a
Like most web developers these days, I'm thoroughly enjoying the benefits of solid MVC
In most samples I have seen on the web, DI in MVC Controllers is
Most CF MVC Frameworks use the front controller pattern. Usually Search Engine Safe (SES)
I'm seriously confused about the concept of the 'Model' in MVC. Most frameworks that
I've written several Web MVC apps but never before in PHP, and I'm trying
Just started looking at some MVC JS framework / library and most of them
I looked at Haskell web frameworks like Snap and Yesod. Most seem to implement

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.