APP与H5页面交互:
简简单单演绎APP与H5页面如何实现交互
话不多说上代码:
@Override
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>绑定结果</title>
<script type="text/javascript" src="<?php echo $__PUBLIC__; ?>/js/jquery-1.8.1.min.js"></script>
</head>
<body bgcolor="#eee">
<div>
<?php if( $terminal == 1 ){ ?>
<!--安卓-->
<?php if( $result['code'] == 0 ){ ?>
<script type="text/javascript">
function openEbcSuccess(){
var jsonData = '<?php echo $result["json_data"]; ?>';
window.I_Finance_Service_Obj_APP2JS.iHfPayCalledByJs( <?php echo $result['code']; ?> , "<?php echo $result['msg']; ?>" , "<?php echo $result['type']; ?>" , jsonData );
};
openEbcSuccess();
</script>
<?php }else{ ?>
<script type="text/javascript">
function openEbcFail(){
var jsonData = <?php echo $result['json_data']; ?>;
window.I_Finance_Service_Obj_APP2JS.iHfPayCalledByJs( <?php echo $result['code']; ?> , "<?php echo $result['msg']; ?>" , "<?php echo $result['type']; ?>" , jsonData );
}
openEbcFail();
</script>
<?php }?>
<?php }elseif( $terminal == 2 ){?>
<!--IOS-->
<script type="text/javascript">
<?php if( $result['code'] == 0 ){ ?>
var uri = 'dianjrjs://iHfPayCalledByJs/<?php echo $all_json; ?>';
window.location.href = uri;
<?php }else{ ?>
var new_uri = 'dianjrjs://iHfPayCalledByJs/<?php echo $all_json; ?>';
window.location.href = new_uri;
<?php }?>
</script>
<?php }elseif( $terminal == 4 || $terminal == 5 ){?>
<!--微信-->
<!-- 1 开户 -->
<form id="weixin_tpc" method="post" action="<?php echo Yod::config('WEIXIN_CALLBACK_URL');?>">
<input type="hidden" name="callback_type" value="6"/>
<input type="hidden" name="data" value="<?php echo Yimi::encrypt($all_json);?>"/>
</form>
<script>
$(function(){
$("#weixin_tpc").submit();
});
</script>
<?php }else{ ?>
UNKNOWN TERMINAL
<?php }?>
</div>
</body>
</html>