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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:53:14+00:00 2026-05-23T18:53:14+00:00

I work on a WordPress site. I want to load search results into the

  • 0

I work on a WordPress site.

I want to load search results into the currently open page using AJAX methods. To be able to do that, I need to obtain the output of the PHP code that does the search, without opening the new page.

Normally, after you type a search word, WordPress opens the new page with URL like this:

mydomain.com/?s=searchword

The output of the PHP code that does the searching is shown in the #container div of that page.

Question: how can I get the search results without opening the new page, so that I can load them using jQuery into the page that is currently open?

I would be grateful for your advice!

  • 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-23T18:53:15+00:00Added an answer on May 23, 2026 at 6:53 pm

    This plugin does it for you pretty much. You might want to look at the source code of the plugin and see how you can leverage it for yourself.

    http://wordpress.org/extend/plugins/threewp-ajax-search/screenshots/

    I suppose you could also call the search page yourself, parse out the #container value and then parse the results list yourself. If you want help with that let me know. Otherwise I think an already developed plugin is pretty convenient.

    As requested here is some more thoughts on how I think I might do this. None of this is tester, but I the general ideas are sound. You will have to tweak things as appropriate to match your installation. For example Get vs Post. Timeout. Request Data.

    1. Use jQuery’s ajax call to request the search page.

      $.ajax({
                      async: true,
                      data: $dataToSend,
                      datatype: 'xml',
                      beforeSend: function() {
                          console.log('rq');
                      },
                      error: function(jqXHR, textStatus, errorThrown) {
                          console.log('error');
                      },
                      success: function(xml, textstatus, jqXHR) {
                          //Process Response Data
                      },          
                      timeout: 10000,
                      type: 'POST',
                      url: 'http://' + document.location.host + '/search'     
              });
      
    2. Process the response and cull out the data you are interested in.
      http://www.switchonthecode.com/tutorials/xml-parsing-with-jquery

      $(xml).find(‘div[class=”post”]’).each( function() {
      $(“#currentPage”).append($(this) + “
      “);
      });

    SO refuses to code block that list bit. So sorry about that.

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

Sidebar

Related Questions

1) I'm using WordPress as a CMS for a site. Therefore I want to
Using a caching plugin for my wordpress site reduced the server load by quite
I recently turned an old Joomla site into a Wordpress site and I want
I want to be able to share videos from my Wordpress site to Facebook
I am working on a migration work to WordPress for a site where all
I want to register a script with wordpress that will work on the backend.
work on SQL Server 2000. want to Automated Email Notifications using SQL Server Job
I want to have lightbox gallery in my Wordpress site.. How do i do
I am trying to implement WordPress into quite a large site with a complex
I'm working on a wordpress site and I want to use jQuery Masonry in

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.