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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:33:09+00:00 2026-05-14T05:33:09+00:00

Is it possible to load an html document using ajax and then perform a

  • 0

Is it possible to load an html document using ajax and then perform a jquery selection on the loaded html?

I want to perform a search against a remote search server and then use the results to reformat an existing page.

EDIT: the find function doesnt seem to return results (length is always 0). Here is the sample html

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>

    <p>Hello world</p>

    <p>good bye world</p>

</body>
</html>

And here is the jQuery:

$(document).ready(function() {

  $.ajax({
    url: 'content/HTMLPage.htm',
    dataType: 'html',
    success: function(data) {

      alert($(data).find('p').length);

    }
  });
});
  • 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-14T05:33:09+00:00Added an answer on May 14, 2026 at 5:33 am

    I really struggled with this. I have managed to load a whole document and select from it correctly, but this one had a doctype.

    Otherwise it seems it is possible but it has its caveats. The items you are selecting need to have at least a parent node. I dont really think I can mark anything off here as an answer just yet.

    This html returned 2 elements:

    <div>
      <p>Hello world</p>
    
      <p>good bye world</p>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load a static text file from an HTML document without using
Is it possible to load an html document into a DOM javascript object so
I'm using pyjd/hulahop/pyxpcom to load a HTML document with an input field, this input
I am using jQuery's load function to get template data from external html files.
Is it somehow possible to load more files via AJAX? Example $.ajax({ url: [test1.html,
Is it possible to load images from an array in jQuery? The array looks
Is it possible to load a single plugin from outside the cake root using
In modern processors it is possible to load a register from memory and then
I have an HTML document, which loads content from a PHP file using an
I have a script which loads content into a iframe using: document.GetElementById('iframeid').src = 'site.html';

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.