Hameed Hameed - 1 month ago 7
HTML Question

How to get selected row value on the next page using jquery?

I want to get selected

row
id on the next page. I want when i click on
button
then selected row id show in next page. Remember next window tab will open.
Here is my jquery function.Its getting
ID
in
value
var when i click on row but i don't know ho to get this id on next page. But i want that, first i select row then i click on button then
id
show on next tab window. Thanks

enter image description here

And here is my
jQUERY
function :

$("#maintable tr").click(function(){
//alert($(this).hasClass("selected"));
if ($(this).hasClass("selected")){
$(this).removeClass("selected");
var value=$(this).find('td:first').html();
alert(value);
}else{
$(this).addClass("selected").siblings().removeClass("selected");
}
});

Answer

In a comment you say:

I try this window.open('http://localhost/new/old.php') this will move to next page

In that case you'd simply add value as a query string parameter. For example:

window.open('http://localhost/new/old.php?id=' + value);

If value might contain more complex character data, you may want to URL-encode it:

window.open('http://localhost/new/old.php?id=' + encodeURIComponent(value));
Comments