OK, I tried out some Ajax, but can't figure it out right now and I'm a
little crunched on time. I DID, however, get a single jQuery function
setup to do what I need:
$j('#user-dialog').hide();
$j('a.user-info').click(function() {
var uid = $j(this).attr('id');
$j('#user-dialog-' + uid).dialog({
autoOpen: false,
show: 'blind',
hide: 'fold',
width: 300
}).dialog('open');
});
And the relevant HTML (using a variable $userID for a placeholder):
<a href="#" id="$userID" class="user-info"
name="$userID">[email protected]</a>
<div id="user-dialog-$userID" class="user-dialog" title="User Info"
style="display:none;">
Data about the user goes here.
</div>
On Oct 6, 9:53 am, Gremlyn1 <[email protected]> wrote:
> <--- Not so good with the AJAX :(
>
> On Oct 1, 6:20 am, Fontzter <[email protected]> wrote:
>
> > If your data structure is the same, just make onedialog, set it to
> > autoOpen: false when the page loads. Then when you click a particular
> > link, get the related data via an ajax call, populate thedialogand
> > open it. This works great and keeps the bloat down on your page and
> > DOM.
>
> > Hth,
>
> > Dave
>
> > On Sep 30, 7:16 pm, Gremlyn1 <[email protected]> wrote:
>
> > > Well I have it rigged for now, but I don't like it because of the load
> > > time. I have PHP individually create adialogfunction based on my
> > > user's ID. I'm sure this isn't the more efficient way to go about
> > > this, but that's what I've got for now... anyone help me out?
>
> > > On Sep 30, 2:23 pm, Gremlyn1 <[email protected]> wrote:
>
> > > > When trying to use the OP's code, mydialogDIVs are not hiding and
> > > > nothing seems to work proerply (I'm obviously doing it wrong), but at
> > > > least when I plug yours in the DIVs are hidden. I just can't get them
> > > > to display, here is what I have: (note: I am using the $j because we
> > > > also have prototype/sciptaculous running)
>
> > > > $j(function() {
>
> > > > var dialog_options = {
> > > > autoOpen: false,
> > > > show: 'blind',
> > > > hide: 'fold',
> > > > width: 250
> > > > };
>
> > > > $j("div.user-dialog").dialog(dialog_options);
> > > > $j("a.user-info").click(function() {
> > > > $("#" + this.id.replace("info","dialog")).dialog("open");
> > > > return false;
> > > > });
>
> > > > });
>
> > > > And I have my links setup like this:
>
> > > > <td>
> > > > <div class=\"user-dialog\" title=\"User Info\">";
> > > > $profile_sql = mysql_query("SELECT * from profiles WHERE
> > > > uid='$id'");
> > > > while ($row = mysql_fetch_array($profile_sql)) {
> > > > echo "<p>
> > > > Name: {$row['first_name']} {$pro['last_name']}<br />
> > > > E-Mail: {$row['email']}<br />
> > > > Organization: {$pro['organization']}<br />
> > > > Location: {$row['location']}<br />
> > > > Phone: {$row['phone']}<br />
> > > > Referrals: {$row['referrals']}<br />
> > > > Reg Date: {$row['reg_date']}<br />
> > > > Last Login: " . date("m-d-Y", strtotime($row
> > > > ['reg_date'])) . "<br />
> > > > </p>";
> > > > }
> > > > echo "</div>
> > > > <a href=\"#\" id=\"user-info\">{$row['email']}</a>
> > > > </td>
>
> > > > Obviously, I am running this through a php while loop to output the
> > > > data from my mysql call.
>
> > > > On Sep 30, 9:24 am, Fontzter <[email protected]> wrote:
>
> > > > > You could use a classes for your elements then do something like this:
>
> > > > > $("div.dialog-player").dialog(options);
> > > > > $("a.links-players").click(function() {
> > > > > $("#" +
> > > > > this.id.replace("link","dialog")).dialog("open");
> > > > > return false;
> > > > > });
>
> > > > > Hth,
>
> > > > > Dave
>
> > > > > On Aug 18, 8:21 am, moleculezz <[email protected]> wrote:
>
> > > > > > Ok, so I finally figured it out.
>
> > > > > > Solution:
> > > > > > $(function() {
>
> > > > > > var options = {
> > > > > > autoOpen: false,
> > > > > > show: 'blind',
> > > > > > hide: 'fold',
> > > > > > width: 800,
> > > > > > modal: true
> > > > > > };
>
> > > > > > var n = 1;
> > > > > > $("tbody tr td a.links-players").each(function(i) {
>
> > > > > > var dlg = $('#dialog-player-' + n).dialog(options);
> > > > > > $('#link-player-' + n).click(function() {
> > > > > > dlg.dialog("open");
> > > > > > return false;
> > > > > > });
> > > > > > n++;
> > > > > > });
>
> > > > > > });
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---