-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
executable file
·55 lines (52 loc) · 1.59 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$('#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 ((val.name.search(myExp) != -1) ||
(val.bio.search(myExp) != -1)) {
output += '<li>';
output += '<h2>'+ val.name +'</h2>';
output += '<img src="images/designer/'+ val.shortname +'_tn.jpg" alt="'+ val.name +'" />';
output += '<p>'+ val.bio +'</p>';
output += '</li>';
}
});
output += '</ul>';
$('#update').html(output);
}); //get JSON
});
$('#login').submit(function() {
var enteredEmailID = $('#emailID').val();
var enteredPassword = $('#password').val();
$.getJSON('login.json', function(data) {
$.each(data, function(key, val) {
alert(val);
if ((val.emailID.search(enteredEmailID) != -1) &&
(val.password.search(enteredPassword) != -1)) {
alert("logged in successfully");
$("#login").prop('action','index.html');
$('#login').submit();
}
else{
alert("password woring");
}
});
}); //get JSON
});
$('document').ready(function() {
$.getJSON('data.json', function(data) {
var output = '<ul class="searchresults">';
$.each(data, function(key, val) {
output += '<li>';
output += '<h2>'+ val.name +'</h2>';
output += '<img src="images/designer/'+ val.shortname +'_tn.jpg" alt="'+ val.name +'" />';
output += '<p>'+ val.bio +'</p>';
output += '</li>';
}
);
output += '</ul>';
$('#update').html(output);
}); //get JSON
});