javascript - How to display details on second page? -
i trying display list of employees after search. works find want extend code display more details on second page after user cliks on cell or button next it.
here code:
<form action="" method="post"><span><div id="result" class="span5"></div></span></table> </form><script language="javascript"> $('#search').click(function() { $.get("index.php/find/findemp",{firstname : $('#fn').val(),lastname : $('#ln').val(),dept : $('#dt').val() },function(data) { // ,jobtitle : $('#jt').val() var names = '<table class="table table-hover">'; var x = 0; $.each(data, function(index, element) { if (index > 0) {x++, names;} names += "<tr class = x><td>"+element.firstname +"</td> "+"<td>"+ element.lastname+ "</td> <td>"+ element.department+"<td/> <td> "+ element.officeday+"</td><td>"+element.avstatus+"</td></tr>"+ "<br/>"; }); names+=''; $('#result').html(names); },"json"); return false; });
my plan x
identifier , display details on second page.
i want use code altho don't understand appreciate advice.
$(".x").click(function() { var name = $(".name",this).html();});
second page code:
<form action="" method="get"> <div > <div>first name: <br /> <input value="<?php echo $name[1]; ?>" type=text id="fn" name='firstname'> </div> <div>last name: <br /> <input value="<?php echo $name[2]; ?>"type=text id="ln" name='lastname'> </div> <div>department name: <br /> <input value="<?php echo $name[3]; ?>" type=text id="dt" name='dept'></div> <div>current job title: <br /> <input value="<?php echo $name[4]; ?>" type=text id="jt" name='jobtitle'> </div> <div>birth date: <br /> <input value="<?php echo $name[5]; ?>" type=text id="dt" name='dept'></div> <div>hire date: <br /> <input value="<?php echo $name[6]; ?>" type=text id="dt" name='dept'></div> <div>gender: <br /> <input value="<?php echo $name[7]; ?>" type=text id="dt" name='dept'></div> <br /><div><input value="update" type="submit" id="update"></div>
reset
the answer not easy work on quite long , works now:
$(document).on('click', '.x', function(e) { var emp_no = $(e.currenttarget).attr('data-emp-no'); window.location = 'index.php/find/display/' + emp_no; });
i pushed create model file employees id, later call them <?= $lecturer_data[0]['firstname'] ?>
Comments
Post a Comment