Skip to content

Basic ui#133

Open
MichaelKearnsSoftwire wants to merge 2 commits intoflaxsearch:luwak-serverfrom
MichaelKearnsSoftwire:basic-ui
Open

Basic ui#133
MichaelKearnsSoftwire wants to merge 2 commits intoflaxsearch:luwak-serverfrom
MichaelKearnsSoftwire:basic-ui

Conversation

@MichaelKearnsSoftwire
Copy link
Copy Markdown

Not necessarily desirable to merge, but I'm opening this PR just so you have it around!

console.log(data);
if(data.matches.length > 0) {
// display results
$('#results').append(getGood(data.matches[0]));
Copy link
Copy Markdown

@ngondard ngondard Dec 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The match url sends an array as a result, while data.matches[0] processes only the first item . May I suggest adapting the getGood function so that it handles an array (see my next comment), then calling it with the whole matches array as a parameter?
$('#results').append(getGood(data.matches));

'<img src="ui/img/found.png">' +
'</div>' +
'<div class="list-right">' +
'<h3> Hurrah - we have found a match and its id is ' + item[0] + '</h3>'
Copy link
Copy Markdown

@ngondard ngondard Dec 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Herebelow my proposition for parsing the result array. In order to insert a <li> list tag within the existing <li>, I added an <ul> element.

	'<h3>Hurrah - here comes the match list!<ul>'
	// Parses result array in a list
	for(var i in item) {
		output += '<li>id: ' + item[i] + '</li>';
	}
	output += '</ul></h3>';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants