标签:http java os io strong ar cti div
通过javascript库JQuery实现页面跳转功能代码的四段代码实例如下。
实例1:
| 1 2 3 4 | $(function(){varpn = $("#gotopagenum").val();//#gotopagenum是文本框的id属性location.href = "NewList.aspx?pagenum="+pn;//location.href实现客户端页面的跳转}); | 
实例2:
实现跳转:window.location = ‘user!add.action?id=1‘;
如果需要ajax无刷新的异步请求:
| 1 2 3 4 5 6 7 8 9 10 11 | $.ajax({   url:‘user!add.action?id=1‘,   type:"POST",   cache : false,   dataType : "json",   data : {activityId:activityId.val()},   success:function(data) {        alert("请求成功");    });   }  }); | 
实例3:
button按钮在单击时激发jquery代码(里面有条件判断如果成功就让跳转页面,如果条件不满足就不让他跳转)
| 1 2 3 4 5 | if(条件 == true){ document.location.href=目标url}else{ alert("条件为满足");} | 
实例4:
通过ajax实现跳转:
| 1 2 3 4 5 6 7 | $.ajax(function(){type:"POST",dataType:"json",url:"index.php",//请求页面data:"{id=1}",complete:function(){location.href ="http://www.169it.com"}//跳转页面}) | 
通过javascript库JQuery实现页面跳转功能代码,布布扣,bubuko.com
标签:http java os io strong ar cti div
原文地址:http://www.cnblogs.com/besty/p/3913693.html