PDA

View Full Version : Live Search using Ajax and JSON doesn't work on Plunker!



kayut
01-20-2017, 05:05 PM
Hi,

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
http://plnkr.co/edit/ZkXMcRsHCuYg4axN5DL8?p=preview

Thanks

jscheuer1
01-20-2017, 05:44 PM
You don't really have any code I can see other than this:


$(document).ready(function(){

$.getJSON('data.json', function(data) {
console.log(data);
}); // get JSON

}); // document ready

That much appears to be working. I see this in the console (I expanded one element to see that it contains the expected information):


Object
speakers
:
Array[9]
0
:
Object
1
:
Object
bio
:
"The Artist to Watch in 2012 by the London Review, Johnathan has already sold one of the highest priced-commissions paid to an art student, ever on record. The piece, entitled Gratitude Resort, a work in oil and mixed media, was sold for $750,000 and Jonathan donated all the proceeds to Art for Peace, an organization that provides college art scholarships for creative children in developing nations"
name
:
"Jonathan G. Ferrar II"
reknown
:
"Artist to Watch in 2012"
shortname
:
"Jonathan_Ferrar"
__proto__
:
Object
2
:
Object
3
:
Object
4
:
Object
5
:
Object
6
:
Object
7
:
Object
8
:
Object
length
:
9
__proto__
:
Array[0]

The page appears to be using jQuery 1.8.3 though, not the apparently desired 2.2.4.