簡體   English   中英

如何從一個HTML頁面重定向到另一HTML

[英]How to make redirect from one html page to another html

我已經創建了一個單頁應用程序。 基本上,我創建了一個HTML頁面,該頁面接受來自用戶的輸入並調用Javascript,該Javascript進行ajax調用以進行休息服務。 返回響應后,我將數據追加到表並在同一頁面中顯示結果。 但是現在我希望一頁中的輸入文本框和表格在另一頁上顯示。 我該如何實現?

我的HTML代碼:

   <!DOCTYPE html>
   <html>
   <head>
   <script type="text/javascript" src="index.js"></script>
   <style>
   .ApplicationName{
     font-family: 'Times New Roman';
     font-style: normal;
     font-size:40px;
     color: rgba(66,138,201,1);
     height:38px;
     width:auto;
     font-weight: bold;
     margin-left: 380px;
     text-align:center;
    }
   table{
     font-family:arial,sans-serif;
     border-collapse: collapse;
     width:100%
    }
   td,th{
     border:1px solid #dddddd;
     text-align: left;
     padding: 20px;
   }
   #table {
     margin-left: -850px;
    }
  </style>
  </head>
   <body>
    <div class ="container" style="background-color: rgba(66,138,201,1)">
            <div class ="navbar-header">
            <p  class="ApplicationName" style="color: white;">JIRA-STATUS TRACKER</p>
            </div>
    </div>
    <br>
    <div class="col-sm-4"></div>
    <div class="row">

                  <div class="form-group col-sm-4">
                     <label for="name">Search by Manager</label>

    <input type="managerid" class="form-control" id="ManagerId"   type ="text" autocomplete="off"  maxlength="8" onkeyup="alphanumOnly(this)" placeholder="ManagerId"></input>
    <button id="submit" class="btn btn-primary" style="margin-top: 3px;" onclick="getReporteeList(); this.disabled = true;" >Submit</button></a>
    <input type="reset" class="btn btn-primary" style="margin-top: 3px;" value="Reset" onClick="window.location.reload()"></input>   

   </div>
    <br>
    <div id ="table" style="display:none">
            <div class="container text-center" >
                    <div class="row">
                    <div class="col-sm-4"></div>
                    <div class="col-sm-4">
                       <div class="panel panel-primary">
                       <div class="panel-heading" >Reportees  List</div>
    <table id = "employee_table" class="table table-hover" cellspacing="0" width="100%">
                <tr>
                    <th>Number</th>
                    <th>Name</th>
                    <th>UserId</th>
                    <th>Count</th>
                </tr>

            </table>
    </div>
    </div>
    <div id ="jiratable" style="display:none"> 
            <div class="container text-center" >
                    <div class="row">
            <div class="col-sm-4"></div>
            <div class="col-sm-4">
                <div class="panel panel-primary" style="width: 220%;">
                    <div class="panel-heading">JIRA - List</div>
                    <table class="table table-hover">   
            <table id = "Jira_table"  class="table table-hover" cellspacing="0" style="width:220%;table-layout:fixed">
                            <thead>
                            <tr>
                                <th width="80">Number</th>
                                <th>JiraNumber</th>
                                <th>JiraStatus</th>
                                <th>EmailId</th>
                            </tr>  
                           </thead> 
              </table>
            </div>
            </div>
            </div>
            </div>
            <html>
</html>

我的Javascript代碼:

            function getReporteeList() {
            var name = document.getElementById('ManagerId').value;
            var start = new Date().getTime();
            console.log(start);
        $.ajax({

           url:'http://localhost:8088/JirasTrackingApp/reporter/
          Reportees/ReporteeList/'+ $("#ManagerId").val(),
           type:'GET',
         "crossDomain": true,

          dataType: 'json',
success: function(result){   
         var end = new Date().getTime();
         var dur = end - start;
         console.log("millisecs passed",dur);   
           var  size = result.length;
           var content = '';
           var number = 1;
           if(size>0){
            document.getElementById('table').style.display="block";
           $.each(result,function(key,value){
               var num    = number++;
               content += '<tbody>';
               content += '<tr>';
               content += '<td>'+num+'</td>';
               content += '<td>'+value.Name+'</td>';
               content += '<td>'+value.UserId.toUpperCase()+'</td>';
               content += '<td>'+'<a href="#" onclick ="getJira(\'' + value.UserId + '\')">'+value.count+'</a>'+'</td>';
               content += '</tr>';
               content += '<tbody>';
           });

           $('#employee_table').append(content);

        }   
          ....There is one more table jiratable in a similar way.

現在,我將2張表顯示在單個頁面中,但是如何在一頁中顯示輸入字段。 然后單擊提交按鈕,它應該重定向到另一個頁面以顯示表格。 請幫助我解決這個問題。

您將需要以下內容:

 // Simulate a mouse click: window.location.href = "http://www.w3schools.com"; // Simulate an HTTP redirect: window.location.replace("http://www.w3schools.com"); 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM