2012-11-14 2 views
0

ajax 호출을 사용하여 사용자 정의 Google 검색을 수행하려고합니다.ajax 호출을 사용하는 사용자 정의 Google 검색

Google에서 검색 한 결과 good link입니다.

여기서 텍스트 상자와 버튼이 자동으로 표시되며 검색 버튼을 클릭하면 결과가 div에 표시됩니다.

하지만 자기가 만든 텍스트 상자에 쓰여진 항목을 검색하고 싶습니다. 의미 : 수동으로 텍스트 상자와 버튼을 만들었습니다. 내 텍스트 상자에 작성된 쿼리로 내 버튼을 클릭하면 결과를 표시하고 싶습니다.

도와주세요

미리 감사드립니다.

답변

2

쓰기이있는 버튼 제출

// get a custom search control & keep it in cseControl 
// note: put your own custom search ID number here 
var cseControl = new google.search.CustomSearchControl('009827885688477640989:igzwimalyta'); 
// open pages from search results clicks on the same page 
cseControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF); 
// when there are no matches, explain why 
cseControl.setNoResultsString("Sorry, there are no pages in this web site that match all the search terms."); 
// make the search field visible in div with ID 'cseDiv' 
cseControl.draw('divGoogleResult'); 

cseControl.execute(userInput); 
$('.gsc-search-box').hide();