/    Sign up×
Community /Pin to ProfileBookmark

populating and displaying array contents

hi,
i’m using google AJAX to implement a search engine that upon retreival of the search results gets them categorized as relevant and non-relevant and then processes them further for better search results.

Wat i’m doing in the code below is that i’m simply implementing a web search and then when the search ends i’m calling a function OnLoad.prototype.OnSearchComplete = function(sc,Searcher) that obtains the array of docs that the user wants to mark as relevant.

the function OnLoad() is working fine and gives no errors with out the function call at the end ( i’ve placed it here just for the sake of refrence), however when control goes to the second function it gives me two errors “ERROR: Expected ‘)’ ” and “ERROR: Object Expected”, i’ve looked at the code a gazillion times but i cant figure it out………..can someone please help me….?

[code]
function OnLoad() {

// Create the Google search control
var searchControl = new GSearchControl();

// for tabbed display
var drawOptions = new GdrawOptions();
drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);

//for expanded mode
var options = new GsearcherOptions();
options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);

// the result set for web search returns 8 docs
var webSearch = new GwebSearch();

// These allow you to customize what appears in the search results
searchControl.addSearcher(webSearch,options);

// Incase null set is returned for entered query
searchControl.setNoResultsString(“No Match Found For Entered Query”);

// will return 8 results for each result set
searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);

// “Draw” the control on the HTML form
searchControl.draw(document.getElementById(“searchcontrol”), drawOptions);

// tell the search control to call be on stop
searchControl.setSearchCompleteCallback(this, OnLoad.prototype.OnSearchComplete);
}

OnLoad.prototype.OnSearchComplete = function(sc,Searcher)
{
// var wsarray = new GwbSearch();
var num = window.prompt(“Enter the Number of relevant documents”, “”);
var rel_docs = new Array();

for(var i = 0 ; i < num ; i++)
{
rel_docs[i] = window.prompt(“Enter the document number”,””);
}

for(var x = 0 ; x < rel_docs.length ; x++)
{
alert(rel_docs[x]);
}
}
[/code]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @sk230126 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...