Friday, 15 July 2011

php - Window.location.href not working in Google Chrome -



php - Window.location.href not working in Google Chrome -

i'm trying pass id item deleted through url after ok clicked in confirmation box, nil happens. works in ie i'd work chrome well.

<script> function dltcnfrm(id) { var r=confirm("delete product?") if (r) { window.location.href = "http://localhost/e-com/index.php/product/delete_item/" + id; } } </script>

code within html

foreach ($items $res) { $id = $res['id']; . . <td><?php echo "<a href='' onclick='dltcnfrm($id)'>delete</a>"; ?></td>

i have tried several other methods including

location.assign();

adding homecoming false; underneath if statement

could seek using chrome browser? chrome version 24.0.1312.57 m

i betting id string have error

<td><?php echo "<a href='' onclick='dltcnfrm(\"$id\")'>delete</a>"; ?></td>

you want cancel link click also.

<td><?php echo "<a href='' onclick='dltcnfrm(\"$id\"); homecoming false'>delete</a>"; ?></td>

but should never never never delete action request. fetching data, post updating data.

php javascript

No comments:

Post a Comment