首页 > 代码库 > ajax的上拉功能
ajax的上拉功能
<div class="footReturn">
<!-- <a id="showcard" onClick="showcard()" class="submit" href="javascript:void(0)">保 存</a> -->
<div class="window" id="windowcenter">
<!-- <div id="title" class="wtitle">保存<span class="close" id="alertclose"></span></div> -->
<div class="content">
<div id="txt"></div>
</div>
</div>
</div>
</div>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
function showcard(){
var submitData= http://www.mamicode.com/{
imo: $("#imo").val(),
type: $("#type").val(),
taocan: $("#taocan").val(),
userId: $("#userId").val(),
};
$.ajax({
type:"POST",
url:"{:U(‘Card/cord‘)}",
//url:"__ROOT__/testpay/jsapicall.php",
data:submitData,
dataType:"json",
success:function(data){
//alert(data);
if (data.errno == 200) {
alert(data.error);
location.href="http://www.mamicode.com/weishop/index.php?m=Card&a=index";
} else {
alert(data.error);
}
}
})
//location.href="http://www.mamicode.com/__ROOT__/testpay/jsapicall.php";
}
$("#windowclosebutton").click(function () {
$("#windowcenter").slideUp(500);
});
$("#alertclose").click(function () {
$("#windowcenter").slideUp(500);
});
//////////////////////////////////////////////////////////////////
if($return){
$re[‘errno‘] = ‘200‘;
$re[‘error‘] = ‘充值成功‘;
}else{
$re[‘errno‘] = ‘0‘;
$re[‘error‘] = ‘充值失败‘;
$re[‘url‘] = "";
}
echo json_encode($re);