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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:10:09+00:00 2026-05-20T17:10:09+00:00

I wrote a script and I want to change the language. I managed to

  • 0

I wrote a script and I want to change the language. I managed to do this using the .ajax() function in jQuery and fetching the new HTML.
Afterwards I want to replace the old HTML with the new HTML.

However, I do not want to exchange the whole HTML, but only part of it.
I know that the HTML returned includes a <div id="myDivId">...</div>, so I only want to get the content of that div from the HTML returned, and replace the content of my current div with the new content.
But, I can’t seem to figure out how to fetch only that content from my new HTML. How can I do that? I tried using find, but no success.

$.ajax({
    type: "GET",
    url: "ajax.php",
    data: "action=languagepack&subAction=box&newIso="+newIso+"&country="+country,
    success: function(htmlCode){
        var box = $(htmlCode).find('#myDivId').html();

        alert(box);
    }
});

Best regards,
Paul Peelen

  • 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-20T17:10:10+00:00Added an answer on May 20, 2026 at 5:10 pm

    Try jQuery.load()

    This method is the simplest way to
    fetch data from the server. It is
    roughly equivalent to $.get(url, data,
    success) except that it is a method
    rather than global function and it has
    an implicit callback function. When a
    successful response is detected (i.e.
    when textStatus is “success” or
    “notmodified”), .load() sets the HTML
    contents of the matched element to the
    returned data. This means that most
    uses of the method can be quite
    simple:

    $('#result').load('ajax/test.html');
    

    Loading Page Fragments

    The .load() method, unlike $.get(), allows us to specify a
    portion of the remote document to be
    inserted. This is achieved with a
    special syntax for the url parameter.
    If one or more space characters are
    included in the string, the portion of
    the string following the first space
    is assumed to be a jQuery selector
    that determines the content to be
    loaded.

    We could modify the example above to use only part of the document that
    is fetched:

    $('#result').load('ajax/test.html #container');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I wrote a small page: <html> <head> <script type=text/javascript src=jquery.js></script> <script> function slide()
Consider the following HTML: (Written for Google Chrome) <html> <head> <script language=javascript> function AddToIFrame(){
i have wrote a script to produce an array of data but now want
I wrote a Python GUI script with Tkinter, and now I want to convert
I am new to perforce, I want to write batch script for copying same
I want to change this CSS text-align. it's right but I want it to
This is a crude korn shell script that someone else wrote. I don't know
I want to use this script but I can't make it work. They have
I wrote a script of my portfolio, which works almost how I want it,
I wrote a script that accessed a bunch of servers using nc on the

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.