Search code examples
facebookfacebook-graph-apifacebook-pagesearch-box

Dynamically search for Facebook pages on my site


I would like to have a search box on my site that works like the Facebook search box, but searching only for Pages.

I know that using the Graph API I can do searches like these:

search?q=London&type=page

and it will return a list of pages related to the keyword "London".

The difference is that I would like it to be dynamic. So that when the user starts typing "Lon" it starts suggesting pages. How can I do it?


Solution

  • Well the most straightforward is that you just call the API as the user types

    search?q=L&type=page
    search?q=Lo&type=page
    search?q=Lon&type=page
    search?q=Lond&type=page
    search?q=Londo&type=page
    search?q=London&type=page
    

    And update your app view after each API call.