Live search with JSON and Ajax is not working on Plunker!


I’m trying to test a live search using JSON and Ajax on Plunker.
However the code doesn’t work!
Is anything wrong with my code or Plunker isn’t able to handle Ajax requests?

Here is my example


It works for me. Though it outputs data since you used quotes. If you want to output the data that is fetched by the JSON request, you should remove the quotes.

On which line should I remove the quotes?

The line where you console.log data.

Thanks for your reply. But the code you are talking about is very old version of it.
Could you please check again?
The script.js should look like this:

$('#search').keyup(function() {
var searchField = $('#search').val();
var myExp = new RegExp(searchField, "i");

$.getJSON('data.json', function(data) {
	var output = '<ul class="searchresults">';
	$.each(data, function(key, val) {
		if (( != -1) ||
		( != -1)) {
			output += '<li>';
			output += '<h2>'+ +'</h2>';
			// output += '<img src="images/'+ val.shortname +'_tn.jpg" alt="'+ +'" />';
			output += '<p>'+ +'</p>';
			output += '</li>';
	output += '</ul>';
}); //get JSON