I am new to jQuery. I want to pass value from one page to another page using jQuery. I have also javascript code for passing this value. But I want to do the same things using jQuery.
My php and Javascript code is as below
PHP Code:
<?php
for ($i=1; $i<count($array)+1; $i++) {
?>
<tr>
<td><?php print_s($array[$i]['open_date']); ?></td>
<td style="width: 120px" ><?php print_s($array[$i]['group']); ?></td>
<td style="width: 150px" ><?php print_s($array[$i]['division']); ?></td>
<td style="width: 30px" ><?php print_s($array[$i]['control_no_parent']); ?>
<input type="hidden" name="group[<?php print_s($i); ?>]" id="group[<?php print_s($i); ?>]" value="<?php print_s($array[$i]['group']); ?>" />
<input type="hidden" name="division[<?php print_s($i); ?>]" id="division[<?php print_s($i); ?>]" value="<?php print_s($array[$i]['division']); ?>" />
<input type="hidden" name="control_no_parent[<?php print_s($i); ?>]" id="control_no_parent[<?php print_s($i); ?>]" value="<?php print_s($array[$i]['control_no_parent']); ?>" />
</td>
<td>
<?php print_s($array[$i]['control_no_child']); ?>
<input type="hidden" name="control_no_child[<?php print_s($i); ?>]" id="control_no_child[<?php print_s($i); ?>]" value="<?php print_s($array[$i]['control_no_child']); ?>" />
</td>
<td><?php print_s($array[$i]['title']); ?></td>
<td><input type="submit" name="disp_btn[<?php print_s($i); ?>]" class="w50" value="表 示" onClick = "tekeOver(<?php print_s($i); ?>)"/></td>
</tr>
<?php
}
?>
Javascript Code:
function tekeOver(RowNo) {
document.getElementById('RowNo').value = RowNo
document.getElementById('group').value = document.getElementById('group[' + RowNo + ']').value
document.getElementById('division').value = document.getElementById('division[' + RowNo + ']').value
document.getElementById('control_no_parent').value = document.getElementById('control_no_parent[' + RowNo + ']').value
document.getElementById('control_no_child').value = document.getElementById('control_no_child[' + RowNo + ']').value
}
In my opinion,we have some ways. Firstly, we can use cookie if we don't care the suporting of the browser. The first page:
$.cookie('the_cookie', 'the_value');
Another page:
$.cookie('the_cookie');
Of course, we need jquery plugin jquery.cookie.js What's more, we can transfer value in url.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.