我正在尝试做一个实时投标系统来投标工作。我做了实时代码,我可以在表格中查看工作。在每一行中都有一个链接,当我单击它时,它应该将我带到另一个页面,其中 url 中包含 id 值。我的问题是,当我单击“应用”链接时,它没有将我带到第二页。 有人可以帮我吗?

 $(document).ready(function(){ 
done(); 
   }); 
 
 function done(){ 
 setTimeout(function(){ 
updates(); 
 done(); 
 
},500   ); 
 } 
 
 function updates(){ 
 
   $.getJSON("jobs_by_company_PHP.php", function(data){ 
 
$(".text_2").empty(); 
$("#subbu").empty(); 
 
$.each(data.result,function(){  
 
     $(".text_2").append("<style>table, td, th {    border: 1px solid #ddd; 
   text-align: left; width:400px;  font-size: 30px;}"+ 
               "     table {"+ 
            "  border-collapse: collapse;"+ 
            "  width: 170%; "+ 
             "   font-size: 30px;  "+ 
             "margin-left:0px;"+ 
         " } "+ 
 
        "  th, td {"+ 
        "width:400px;"+ 
         "     padding: 15px;  "+ 
          "      font-size: 30px;   "+ 
         " }      "+ 
 
 
 
     "</style> <table  summary='Summary Here' cellpadding='0' cellspacing='0'>" + 
     "<thead>" + 
        "<th>  ID </th>"  + 
        "<th>Name</th>"  + 
         "<th>end_date</th>"  + 
          "<th> time</th>"  + 
           "<th> apply</th>"  + 
    "  </tr>  "+ 
  "  </thead>"+ 
 
    " <tbody>  "    + 
      '<tr class="light">' + 
 
    "<td>"+this['id']  +" </td>" + 
 
    "<td> "+this['name']+" </td>" + 
      "<td> "+this['end_date']+" </td>" + 
       "<td> "+this['time']+"</td>" + 
 
     "<td><a onclick="+ 'location.href="../index.php?id="'+this['id']+'";"'+ 
       "a>Apply</a></td> "+ 
 
 
     "</tr>"+ 
 
  "  </tbody>        "+ 
 
    "</tr> "+ 
    " </tbody>"+ 
    "</table>"); 
}); 
 
}); 
} 

请您参考如下方法:

id="'+this['id']+'";" 给出 id="whateverid" 删除你的 id 周围的引号,例如 id='+this['id']+';"


评论关闭
IT虾米网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!