-
Notifications
You must be signed in to change notification settings - Fork 0
/
index3.js
36 lines (29 loc) · 998 Bytes
/
index3.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
const Searching = Search.prototype;
function Search(){
this.keyword = document.querySelector('input[name = "search"]');
this.engine = document.querySelector('.SelectSearch');
this.button = document.querySelector('.img-button');
this.form = document.querySelector('.search');
let engine = this.engine.value;
let keyword = this.keyword.value;
if(engine === 'google'){
location.href = 'https://www.google.co.kr/search?q=' + keyword;
}else if(engine === 'naver'){
location.href = 'https://search.naver.com/search.naver?query=' + keyword;
}
}
$.ajax({
url: "http://stackoverflow.com",
data: { uname: "test" },
type: "GET",
beforeSend: function(xhr){xhr.setRequestHeader('X-TOKEN', 'xxxxx');},
success: function() { alert('Success!' + authHeader); }
});
or in this way,
$.ajax({
url: "http://stackoverflow.com",
data: { uname: "test" },
type: "GET",
headers:{ "X-TOKEN": 'xxxxx'},
success: function() { alert('Success!' + authHeader); }
});