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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:34:34+00:00 2026-06-18T18:34:34+00:00

Here I am using jQuery ajax: $.ajax({ type: GET, url: URL, data: { Mode:

  • 0

Here I am using jQuery ajax:

$.ajax({
    type: "GET",
    url: URL,
    data: { Mode: "POB1"},
    success: function (data) {
        var Html = $.trim($(data).find("#divpob").html());
        if (Html) {
            $(Html).find(".lblpob").text("UserName" + Username);
            $(".DivRprt").html(Html);
        }
    }
});

here value of lblpob didn’t get change, but if i use .clone() like this

if (Html) {
    var Html2 = $(Html).clone(true);
    $(Html2).find(".lblpob").text("UserName" + Username);
    Html = Html2;
    $(".DivRprt").html(Html);
}

lblpob gets changed.

What difference .clone() is making here ?

  • 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-18T18:34:35+00:00Added an answer on June 18, 2026 at 6:34 pm

    There’s an issue with temporary DOM objects and html as string. I’ll break it down line by line:

    What your first code does:

        var Html = $.trim($(data).find("#divpob").html());
    

    Both the call to .html() and to $.trim() makes sure your Html var holds a string, not a live DOM object.

        $(Html) ...
    

    This turns the Html string into a new DOM object (that you don’t assign into a var),

        ... .find(".lblpob").text("UserName" + Username);
    

    and change this unnamed DOM object. Not your Html string.

        $(".DivRprt").html(Html);
    

    But here you use the original Html string to change the html of DivRprt.

    What your other code does:

        var Html2 = $(Html).clone(true);
    

    After creating a new DOM object and cloning it, you assign it into Html2,

        $(Html2).find(".lblpob").text("UserName" + Username);
    

    and here you manipulate it.

        Html = Html2;
        $(".DivRprt").html(Html);
    

    So here you insert the manipulated DOM object into .DivRprt

    My option:

    You don’t need the .clone(), just keep track of the first DOM object:

        if (Html) {
            var Html2 = $(Html)
            Html2.find(".lblpob").text("UserName" + Username);
            $(".DivRprt").html(Html2);
        }
    

    Or:

    Just don’t convert the trimmed data back to string

        var Html = $(data).find("#divpob");
        if (Html.length) {
            Html.find(".lblpob").text("UserName" + Username);
            $(".DivRprt").html(Html);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I make an AJAX request like so using JQuery: $.ajax({ type: GET, url: getvideo.php,
By using jquery ajax function, I can do something like: $.ajax({ url: url, type:
I'm using ajax in wordpress to get the output of a function: jQuery.ajax({ type:
$.ajax({ type: POST, url: some.php, data: name=John&location=Boston, success: function(msg){ alert( Data Saved: + msg
I am using ASP.NET page methods with jQuery. Here is my code, $.ajax({ type:
I am using jQuery ajax method to get response from my server. Here's my
I'm trying to get data from another domain using jQuery. Here is the code:
I'm using jquery to submit my form (with id #myForm here) as follows: $(document).ready(function()
I am using JQuery Accordion. I have this page here: http://www.hauppauge.com/site/support/support_colossus.html#tabs-6 What happens is
In the code below, I update the data-mode value using jquery. That value comes

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.