我试图做一个实时竞价系统来竞标工作。我做了实时代码,我可以查看一个表中的工作。在每一行都有一个链接,当我点击它时,它应该带我到另一个页面,其中包含url中的id值。我的问题是,当我点击Apply链接时,它不会把我带到第二页。有谁能帮帮我吗?
$(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>");
});
});
}发布于 2016-03-24 02:24:04
id="'+this['id']+'";"会给id="whateverid"去掉你id两边的引号,比如id='+this['id']+';"
https://stackoverflow.com/questions/36185514
复制相似问题