Hi,

Now that i have setup everything, i am facing a problem of how to
traverse through the results page, by clicking on the links at the
bottom of the page.

I am using the following code for the links to further search pages at
the bottom of this search page.
[code]
<a href="javascript: callSubmit('<?
echo $url = "http://ajax.googleapis.com/ajax/services/search/web?
v=1.0&q="
    .$searchQuery."&start=".$pg-
>start."&rsz=large&key=ABQIAAAAPJbd6fVsvq3XRmiloFh50RToOL0JAC4cb7rJK5CdsUkjTh5NqBRYQKUCoDmCuE6fep07WNQcFQbjPQ&userip=203.193.157.39";
?> '); " onclick="javascript: callSubmit('<?
echo $url = "http://ajax.googleapis.com/ajax/services/search/web?
v=1.0&q="
    .$searchQuery."&start=".$pg-
>start."&rsz=large&key=ABQIAAAAPJbd6fVsvq3XRmiloFh50RToOL0JAC4cb7rJK5CdsUkjTh5NqBRYQKUCoDmCuE6fep07WNQcFQbjPQ&userip=203.193.157.39";
?> '); target="_self">
[/code]
In the callSubmit function in javascript, i have used as

<script language="javascript" type="text/javascript">
        function callSubmit(newUrl)
         {
                document.getElementById("newQuery").value=newUrl;
                alert(document.getElementById("newQuery").value);
                document.searchForm.submit();
         }
</script>

I am able to get the URL in the alert() window. But the form is not
submitted, and the javascript error reported is : Object does not
support this property or method.

Please help me on this issue.

regards,

saravanan

On Mar 25, 3:26 pm, Jeremy Geerdes <[email protected]> wrote:
> The &start= is to be appended to thehttp://ajax.googleapis.comurl which you 
> call from within your own application to get subsequent pages. The 
> moreResultsUrl is simply to direct your users to where they can run a more 
> comprehensive search on Google itself. I do not know what the parameters you 
> asked about in that url are; you will never need to worry about them.
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.com
> [email protected]
>
> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
> Church!
>
> On Mar 25, 2010, at 1:45 AM,saravananwrote:
>
>
>
> > Hi,
>
> > Thank you very much for your reply. I have one another small query to
> > be clarified by you.
> > In the bottom of the page, we give the links as 1 2....n.
>
> > You have suggested appending of the &start to the url of the query.
> > Shall i use the url as "http://www.google.co.in/search?
> > hl=en&rsz=large&q=i+need+an+apple&start=".$pg->start" or have i got to
> > use the initial url like "http://ajax.googleapis.com/ajax/services/
> > search/web?v.....".
> > where the $pg-> start is getting the value of the start property from
> > the object $json->responseData->cursor->pages.
>
> > Please suggest me.
>
> > Further, google search url is like this "http://www.google.co.in/
> > search?hl=en&rlz=1C1DVCC_enIN361IN361&q=i+need+an
> > +apple&start=20&sa=N". Can you tell me the meaning of the "rlz" and
> > &sa=N in the above URL. This for my knowledge only.
>
> > Thank you..
>
> > On Mar 24, 9:29 pm, Jeremy Geerdes <[email protected]> wrote:
> >> Two things. First, add &rsz=large to your url. This will tell the API to 
> >> return 8 results at a time instead of 4. And second, rather than looking 
> >> at the $json->responseData->cursor->moreResultsUrl, check out the 
> >> $json->responseData->cursor->pages array. This will contain an array of 
> >> the pages you can get. Each element in the array will have a start 
> >> property which you can use to build a new url for the RESTful API. Simply 
> >> add &start=[one of these start properties] to get additional sets of 
> >> results. Once you've exhausted all the pages you can get from the pages 
> >> array, then you can direct users to the moreResultsUrl.
>
> >> Hope that makes sense!
>
> >> Jeremy R. Geerdes
> >> Effective website design & development
> >> Des Moines, IA
>
> >> For more information or a project quote:http://jgeerdes.home.mchsi.com
> >> [email protected]
>
> >> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
> >> Church!
>
> >> On Mar 24, 2010, at 2:35 AM,saravananwrote:
>
> >>> Hi,
>
> >>> I have currently used the following search query: i+need+an+apple.
>
> >>> In my test site, i am using the JSON alongwith PHP to parse the search
> >>> results returned from Google and display them as per my need.
>
> >>> The problem that i face currently is that I get only top 4 results and
> >>> get 8 page references in cursor object. I did get only one url for
> >>> more results in "moreResultsUrl"
>
> >>> I want my page to be analogous to the google search page. I need more
> >>> results and also when i click on the next links in that page, it
> >>> should go to the next search result page.
>
> >>> The code i am using is as follows, This code is in PHP.
>
> >>> [code]
> >>> $ct = 0;
> >>> foreach( $json->responseData->results as $res)
> >>> {
> >>>    ?>
> >>>        <h4> <a href=" <? echo $res->url ?>" target ="_blank" > <?
> >>>            echo ($res->title); ?> </a></h4> <? echo "<br />";
> >>>        echo $res->content."<br />";
> >>>        ?> <a href=" <? echo $res->url ?>" target ="_blank"
> >>> style="color:Green" > <?
> >>>    echo ($res->url); ?> </a> <? echo "<br />";
> >>>        echo "Cached URL: ".$res->cacheUrl."<br />";
> >>> }
>
> >>> echo "<br /><br />";
>
> >>> foreach($json->responseData->cursor->pages as $pg)
> >>> {
> >>> ?> <a href=" <? echo $json->responseData->cursor->moreResultsUrl;?>"
> >>> target="_blank" >
> >>> <? echo $pg->label;
> >>> ?> </a> &nbsp;&nbsp;
> >>> <?
> >>> }
> >>> [/code]
>
> >>> Anybody please help me in getting all links in the current page and
> >>> also tell me ways to get the link url to other search pages as like
> >>> those in google's page.
>
> >>> Thanks,
>
> >>>saravanan
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups 
> >>> "Google AJAX APIs" group.
> >>> To post to this group, send email to 
> >>> [email protected].
> >>> To unsubscribe from this group, send email to 
> >>> [email protected].
> >>> For more options, visit this group 
> >>> athttp://groups.google.com/group/google-ajax-search-api?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Google AJAX APIs" group.
> > To post to this group, send email to 
> > [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-ajax-search-api?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-ajax-search-api?hl=en.

Reply via email to