Sometimes on the WordPress site.

I wish to load search engine results in to the presently open page using AJAX techniques. To have the ability to do this, I have to have the creation of the PHP code that does the search, without having to open the brand new page.

Normally, once you type searching word, WordPress opens the brand new page with URL such as this:

mydomain.com/?s=searchword

The creation of the PHP code that does the searching is proven within the #container div of this page.

Question: how do i obtain the search engine results without having to open the brand new page, to ensure that I'm able to load them using jQuery in to the page that's presently open?

I'd be thankful for your advice!

This wordpress plugin will it for you personally virtually. You might like to consider the source code from the wordpress plugin and find out the best way to leverage it on your own.

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

I guess you might call the search page yourself, parse the #container value after which parse the outcomes list yourself. If you would like assist with that tell me. Otherwise I believe a previously developed wordpress plugin is fairly convenient.

As asked for here's more ideas how I believe I would do that. None of the is tester, however i the overall ideas are seem. You'll have to tweak things as appropriate to fit your installation. For instance Get versus Publish. 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 the data you are looking at. http://www.switchonthecode.com/tutorials/xml-parsing-with-jquery

    $(xml).find('div[class="publish"]').each( function() )

SO will not code block that list bit. So sorry about this.