You need to add onsubmit
event handler to form and make URL request to google search with adding the query parameter to it, something like following
Your form-
<form class="navbar-form navbar-left" role="search" onsumit='submitMyForm'>
and in script tag (assuming you are using jquery)
<scirpt>
function submitMyForm(){
// get query parameter
query= $('#q').val()
// form request URL
reqUrl = 'https://www.googleapis.com/customsearch/v1?key=xxxx&cx=xxx:xxx&q='+query
// make ajax get request
$.get(
reqUrl,
function(data) {
// data contains the search results
},
);
}
</scirpt>
`