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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:07:11+00:00 2026-06-15T02:07:11+00:00

I want to pull data from Google’s Suggest API and display it in my

  • 0

I want to pull data from Google’s Suggest API and display it in my page (probably via the append function). I am confident with parsing JSON but not XML and as far as I can see Google do not offer this API in JSON.

How can I do this? Or, does anyone know how I can access this API in JSON? If anyone does that would be awesome!

The API address is: http://google.com/complete/search?q=google&output=toolbar

My current code is:

        $.ajax({
            type: "GET",
            url: "http://google.com/complete/search?q=google&output=toolbar",
            dataType: "xml",
            crossDomain: true,
            xhrFields: { withCredentials: true },
            success: function(xml) {
                $(xml).find('toplevel').each(function(){
                    var title = $(this).find('suggestion').text();
                    $('<b>'+title+'</b>').appendTo('#page-wrap');
                });
            }
        });

And the error I am getting is: XMLHttpRequest cannot load http://google.com/complete/search?q=wixiy&output=toolbar. Origin is not allowed by Access-Control-Allow-Origin.

  • 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-06-15T02:07:12+00:00Added an answer on June 15, 2026 at 2:07 am

    Since, the API does not support JSON, so you can’t do it just in javascript as it won’t allow cross-domain requests by default. So, you will need an intermediate server-side page like a PHP file, which does the xml request from google and pass the xml to you.

    Javascript

    $.ajax({
        type: "GET",
        url: "getData.php?q=google&output=toolbar",
        dataType: "xml",
        success: function(xml){
            $(xml).find("CompleteSuggestion").each(function(){
                var suggestion = $( this ).find( 'suggestion' ).attr( 'data' );
                var num_queries = $( this ).find( 'num_queries' ).attr( 'int' );
                alert( suggestion + ' has ' + num_queries + ' queries.' );
            });
        }
    });
    

    PHP (getData.php) – This file is on the same server

    $query = $_GET[ 'q' ];
    $out = $_GET[ 'output' ];
    
    header('Content-Type: text/xml');
    echo file_get_contents('http://google.com/complete/search?q='.$query.'&output='.$out);
    

    …or else, you can directly json_encode it and send JSON to your script, which can be easily parsed as well.

    Hope this helps.

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

Sidebar

Related Questions

I want to pull data from a database to display into a ComboBox, and
I'm attempting to pull in data from Google's Shopping API. I'm able to download
I want pull the data from only a specific column, but what Is returned
I have a multidocument application. I want to pull data from each of those
I want to pull data from an source destination. How can I insert rows
Basically, I want to pull data from August to May for a given set
I need to pull data from a database and create an xml file via
I want to pull data from three tables, but if the data doesn't exist
I want to pull data from table Province_Notifiers and also fetch all corresponding items
I am learning ASP.net Ajax. I want to pull data from a db table

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.