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 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

Consider the following HTML: (Written for Google Chrome) <html> <head> <script language=javascript> function AddToIFrame(){
So I wrote this short script (correct word?) to download the comic images from
I want to write a script which cleans the 'run' dialogue automatically every log
I want to write a script that will stop a scheduled task on a
I want to write a script in Ruby to clean up some messed up
As a simple example, I want to write a CLI script which can print
I want to write a sh/bash script that can determine whether a particular directory
I wrote a script to export twitter friends as foaf rdf description. Now I'm
I wrote a script in Ruby. I'd like to run it every day at
I wrote a batch script which recursively updates my source code against the company's

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.