123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- <script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js"></script>
- </head>
- <body>
- <input type="text" id="sddd" value=""/>
- <input type="button" value="提交" onclick="sendfun();"/>
- <script type="application/javascript">
- function getQueryString(name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- var r = window.location.search.substr(1).match(reg);
- if (r != null) return unescape(r[2]);
- return null;
- }
- // 如果jsbridge已经注入则直接调用
- if (window.AlipayJSBridge) {
- // alert("注册成功");
- AlipayJSBridge.call("tradePay", {
- orderStr: decodeURI(getQueryString('paystr'))
- }, function(result) {
- alert(JSON.stringify(result));
- });
- } else {
- // 如果没有注入则监听注入的事件
- // alert("注册失败");
- }
- //上一个页面的内容
- function sendfun() {
- var ss = document.getElementById("sddd").value
- window.location.href = "alipays://platformapi/startapp?appId=20000067&url=" + encodeURIComponent(window.location.href+"?paystr="+encodeURIComponent(ss));
- }
- </script>
- </body>
- </html>
|