Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·49 lines (43 loc) · 1.54 KB
/
Copy pathindex.html
File metadata and controls
executable file
·49 lines (43 loc) · 1.54 KB
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
<html>
<head>
<title>WKJSBridge</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<script type="text/javascript" src="wk_bridge.js" ></script>
<script language="javascript">
// 模拟h5使用native来发送post请求
function pokePost() {
//业务参数
var command = {
'method':'post',
'url':'https:www.baidu.com'
}
window.wk_bridge.nativePost(command, function success(res) {
document.getElementById("returnValue").value = res.result;
}, function fail(res) {
document.getElementById("returnValue").value = res.result;
});
}
// 模拟h5使用native来发送get请求
function pokeGet() {
//业务参数
var command = {
'method':'get',
'url':'https:www.baidu.com'
}
window.wk_bridge.nativeGet(command, function success(res) {
document.getElementById("returnValue").value = res.result;
}, function fail(res) {
document.getElementById("returnValue").value = res.result;
});
}
</script>
</head>
<body>
<h1>按钮调用</h1>
<input type="button" value="Post网络请求" onclick="pokePost()" />
<input type="button" value="Get网络请求" onclick="pokeGet()" />
<h1>回调结果展示区</h1>
<textarea id ="returnValue" type="value" rows="5" cols="40">
</textarea>
</body>
</html>