Skip to content
This repository was archived by the owner on Oct 27, 2021. It is now read-only.

Commit 9dc2a84

Browse files
cleared glitch with submit button
1 parent 19fdeeb commit 9dc2a84

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

script.js

+11-14
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,30 @@ function designHTML(){
2222

2323
function searchCode(keyword){
2424
this.keyword = keyword || 'Developers@Work';
25-
var Api = youtubeAPI();
26-
$.get('https://www.googleapis.com/youtube/v3/search',{
25+
var Api = API();
26+
$.ajax({
27+
url:'https://www.googleapis.com/youtube/v3/search',
28+
data:{
2729
q:this.keyword,
2830
key:Api,
2931
type:'channel',
3032
part:'snippet'
31-
},function(data){
33+
},
34+
async:false,
35+
success:function(data){
3236
temp = data.items;
3337
for(var i=0;i<temp.length;i++){
3438
channelId[i] = temp[i].snippet.channelId;
3539
channelTitle[i] = temp[i].snippet.title;
3640
channelThumbnail[i] = temp[i].snippet.thumbnails.default.url;
3741
}
38-
});
39-
designHTML();
42+
}
43+
});
44+
4045
}
4146

4247
function buttonClicked(){
4348
var keyword = document.getElementById('searchBar').value;
4449
searchCode(keyword);
45-
50+
designHTML();
4651
}
47-
48-
49-
50-
51-
52-
53-
54-

0 commit comments

Comments
 (0)