Implement page jump function code via JavaScript library jquery

Source: Internet
Author: User

The four snippet code example that implements the page jump function code through the JavaScript library jquery is as follows.

Example 1:

1234 $(function(){varpn = $("#gotopagenum").val();//#gotopagenum是文本框的id属性location.href = "NewList.aspx?pagenum="+pn;//location.href实现客户端页面的跳转});

Example 2:

Implementation jump: window.location = ' user!add.action?id=1 ';

If you need an AJAX non-flush asynchronous request:

1234567891011 $.ajax({   url:‘user!add.action?id=1‘,   type:"POST",   cache : false,   dataType : "json",   data : {activityId:activityId.val()},   success:function(data) {        alert("请求成功");    });   }  });

Example 3:

button Buttons fire jquery code when clicked (there is a condition to determine if the success of the jump page, if the condition is not enough to let him jump)

12345 if(条件 == true){ document.location.href=目标url}else{ alert("条件为满足");}

Example 4:

Jump through Ajax:

1234567 $.ajax ( function () { type: "POST" datatype: "JSON" url: "index.php" //request page data: "{id=1}" complete: function () {location.href = "http://www.169it.com" //jump page })
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.