Max Krizh
Max Krizh

Reputation: 595

PHP: proceed to link after a jQueryUI dialog box appears

I have a PHP method that actually displays a list of currently logged in users. It puts all active users into a table like this:

echo '<td><a href="drop.php?uid=' . $id . '" class="DropUser" id="">' . $uname . '</td>';

So, you may see that there is a link also to be able to log out current user.

I want to create a jQueryUI dialog box that appears .on('click') of that link. But I am not able to generate the same link in Javascript to redirect.

Is it possible to create a dialog box that acts like an alert() (stops executing before the "Ok" button is clicked)? Or is there any other solution?

Thanks!

Upvotes: 0

Views: 79

Answers (1)

socksnake
socksnake

Reputation: 44

If you wouldn't like to use AJAX:

$('.DropUser').click( function () {
// use alert
alert('Alerttext');
// and jump to your target
location.pathname='drop.php?uid=' + $(this).attr('id');
});

and your php/html:

echo '<td><a href="#" class="DropUser" id="'. $id . '">' . $uname . '</td>';

UPDATE: (this) refers to the current link...

Upvotes: 1

Related Questions