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 6756203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:29:47+00:00 2026-05-26T13:29:47+00:00

I have a jquery block that does some ajax stuff like this: $.ajax({ url:

  • 0

I have a jquery block that does some ajax stuff like this:

    $.ajax({
    url: '/webservices/manager.asmx/addNew',
    type: "POST",
    dataType: "html",
    data: { id: Id, name: Name, dept: Dept, helpId: HelpId },
    success: function (data) {
        //append to the table
        $('#divManagers').append(data); 
    },
    error: function () {
        //console.log('error');
    }
});

So it passes through just fine, asmx receives the data and I calculate stuff, then finally I respond with something similar to this:

<div id="divContainer">
         <h2>Manager Name</h2>
</div>

Now, even though I have my dataType set to html I get my response encased in an xml string:

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">&lt;div id=divContainer&gt;&lt;/h4&gt;Manager&nbsp;Name&lt;/div&gt;</string>

and they all actually just gets appended to the page, the complete text, without rendering as actual html elements.

What is going on please?

EDIT

I am just constructing the html in my asmx. something like

StringBuilder component = new StringBuilder();
component.appendFormat("<div id='divComponent'><h2>{0}</h2></div>', managerDataRow["ManagerName"].ToString());
return component.ToString();

My asmx is a seperate, proper asmx page, not a [webmethod] method inside a normal aspx page. Thanks.


if there are any difference between my actual output and returned result here it is because I edited it to make it short. thanks.

  • 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-05-26T13:29:48+00:00Added an answer on May 26, 2026 at 1:29 pm

    you can create a jQuery object from the response and read the text value from there to get the desired result.

    $('#divManagers').append($(data).text());
    

    Also this post might answer why you don’t get back straight HTML in the response

    How to get clean/pure HTML from ASMX web service call

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

Sidebar

Related Questions

I have some jQuery that looks like this: $.ajax({ type: POST, url: /Customer/CancelSubscription/<%= Model.Customer.Id
I have a simple html block like: <span id=replies>8</span> Using jquery I'm trying to
I have jQuery code which looks something like this on Button1 Click $('table.result_grid tbody
Say I have jquery code like this: html += '<div class=index>' + item.index +
Let's assume that we have simple jQuery code like the following: var $document =
I have the following jQuery that does find the ASP.NET server control (tested by
I have blocks of content that are toggled on/off via jQuery and I want
I have a javascript/jQuery block as a callback after $.get function: function myCallBack(data, textStatus)
Is it possible to have one jQuery ready block executed after all others have
I have jQuery to select all font elements that are children of the element

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.