Problema cu dialog...:):):):)

Discutii legate de AJAX, jQuery, MooTools, Prototype, Dojo, Yahoo! UI Library,script.aculo.us, ExtJS,AngularJS, Backbone.js, Ember.js, KnockoutJS

Moderator: Moderatori

Avatar utilizator
Khamoaset
Average Member
Mesaje: 160
Membru din: Joi Iul 21, 2011 4:29 pm
Contact:

Problema cu dialog...:):):):)

Mesajde Khamoaset » Dum Mai 06, 2012 1:21 pm

Am facut un dialog jquery UI cu apel Ajax prin GET, cand dau un click pe un jucator imi deschide dialog-ul si apoi il inchid...si cand vreau sa mai vad pe alt jucator si ii dau click pe nume nu-mi mai deschide dialog-ul, de ce? ....ma poate ajuta cineva unde este problema..

Aici este codul test.php :

Cod: Selectaţi tot

<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css">
   <script type="text/javascript" src="http://spartani.phpzilla.net/daa/basic_jquery.js"></script>
   <script language="JavaScript" type="text/javascript" src="http://spartani.phpzilla.net/daa/basic_tooltip.js"></script>
 <script type="text/javascript">
   $(document).ready(function() {
var name = $("div#user_list a").attr("alt");      
 $("div#normal-form").dialog({
         autoOpen: false,
         height: 400,
         width: 813,
         title: name,
         position: 'center',
         resizable: false
            });   
            
$('a, td, img, div, p, table, form, label, input').tooltip({
         track: true,
         delay: 0,
         showURL: false,
         showBody: " - ",
         fade: 250
});         
   

       $("div#user_list").find('a').click(function() {
      var name = $(this).text();
      
      var url ="test2.php?name="+name;
         $.ajax({
          url: url,
          type: "GET",
          data: "name="+name,
          success: function(result){
            $('#result').html(result);
          }
           });
      $("div#normal-form").dialog("open");
      return false;
   });
   
});   
  </script>
<style>
<!--
#tooltip {
      position: absolute;
      z-index: 99999;
      border: 1px solid #ffffff;
         -moz-border-radius-topleft: 4px;
         -webkit-border-top-left-radius: 4px;
         -moz-border-radius-topright: 4px;
         -webkit-border-top-right-radius: 4px;
         -moz-border-radius-bottomleft: 4px;
         -webkit-border-bottom-left-radius: 4px;
         -moz-border-radius-bottomright: 4px;
         -webkit-border-bottom-right-radius: 4px;
      border-radius: 4px;
      background-color: #000000;
      color:#ffffff;
      font-weight:bold;
      font-size:100%;
      font-family:normal;
      padding: 5px;
      opacity: 0.98;
}
-->
</style>
 
<div id="user_list">
      <?php
         include 'connect.php';
         $result = mysql_query("SELECT * FROM test_user ORDER BY level");

         for ($i=0; $i<=0; $i++);
         while($row = mysql_fetch_array($result))
           {
           echo "<a href='#' alt='Profil jucator' title='".$row['username']."'>" . $row['username'] . "</a> {".$i++."} <br />";
           }
      ?>
</div>
   
   
   
<div id="normal-form">
   <div id="result"></div>
</div>


test2.php :

Cod: Selectaţi tot

   <script type="text/javascript" src="http://spartani.phpzilla.net/daa/basic_jquery.js"></script>
   <script language="JavaScript" type="text/javascript" src="http://spartani.phpzilla.net/daa/basic_tooltip.js"></script>
<script type="text/javascript">
   $(document).ready(function() {
       $('a, td, img, div, p, table, form, label, input').tooltip({
         track: true,
         delay: 0,
         showURL: false,
         showBody: " - ",
         fade: 250
      });
   });   
  </script>
  <style>
<!--
#tooltip {
      position: absolute;
      z-index: 99999;
      border: 1px solid #ffffff;
         -moz-border-radius-topleft: 4px;
         -webkit-border-top-left-radius: 4px;
         -moz-border-radius-topright: 4px;
         -webkit-border-top-right-radius: 4px;
         -moz-border-radius-bottomleft: 4px;
         -webkit-border-bottom-left-radius: 4px;
         -moz-border-radius-bottomright: 4px;
         -webkit-border-bottom-right-radius: 4px;
      border-radius: 4px;
      background-color: #000000;
      color:#ffffff;
      font-weight:bold;
      font-size:100%;
      font-family:normal;
      padding: 5px;
      opacity: 0.98;
}
-->
</style>
<?php
include "connect.php";

$user = $_GET['name'];

$info = mysql_fetch_assoc(mysql_query("SELECT * FROM test_user WHERE username='$user'"));

//////////////////////////////////////////////////////////////////////////////////////////////

$weapon_n = $info['weapon_spot']; //1
$helmet_n = $info['helmet_spot']; //2
$amulet_n = $info['amulet_spot']; //3
$clothing_n = $info['clothing_spot']; //4
$animal_n = $info['animal_spot']; //5
$pants_n = $info['pants_spot']; //6
$shoes_n = $info['shoes_spot']; //7
$produs_n = $info['produs_spot']; //8

      $weapon = mysql_fetch_array(mysql_query("SELECT * from items where `name`='$weapon_n'")); //1
      $helmet = mysql_fetch_array(mysql_query("SELECT * from items where `name`='$helmet_n'")); //2
      $amulet = mysql_fetch_array(mysql_query("SELECT * from items where `name`='$amulet_n'")); //3
      $clothing = mysql_fetch_array(mysql_query("SELECT * from items where `name`='$clothing_n'")); //4
      $animal = mysql_fetch_array(mysql_query("SELECT * from items where `name`='$animal_n'")); //5
      $pants = mysql_fetch_array(mysql_query("SELECT * from items where `name`='$pants_n'")); //6
      $shoes = mysql_fetch_array(mysql_query("SELECT * from items where `name`='$shoes_n'")); //7
      $produs = mysql_fetch_array(mysql_query("SELECT * from items where `name`='$produs_n'")); //8

//////////////////////////////////////////////////////////////////////////////////////////////

?>
   
<table cellpadding="0" cellspacing="0" border="1" >
   <tr>
      <td>Nume: <?php echo $user; ?></td>
   </tr>
   <tr>
      <td>Bani: <?php echo $info['money']; ?></td>
   </tr>
   <tr>
      <td>Bani in banca: <?php echo $info['money_bank']; ?></td>
   </tr>   
   <tr>
      <td><img src="../images/avatars/<?php echo $info['avatar']; ?>" /></td>
   </tr>
</table>

<style type="text/css">
td.back
{
background-image:url('../images/inventory/body_arms.png');
}
.tooltipBox
{
    filter: alpha(opacity = 100); \-moz-opacity: 1; opacity: 1;
    background-image:url('/\images/selectedBg.jpg');
   background-repeat:repeat;
    border: 1px solid #000;
   color: #000;
   padding:2px;
   margin:0px;
    font-family:Tahoma;
}
</style>

<table cellpadding="0" cellspacing="0" border="1" >
   <tr>
   <?php

   if($weapon) //1
   echo "<td class='back'><img title='$weapon[info_name]' src='../images/inventory/items/body_inventory/$weapon_n.png' /></td>";
   if($helmet) //2
   echo "<td class='back'><img title='$helmet[info_name]' src='../images/inventory/items/body_inventory/$helmet_n.png' /></td>";
   if($amulet) //3
   echo "<td class='back'><img title='$amulet[info_name]' src='../images/inventory/items/body_inventory/$amulet_n.png' /></td>";
   if($clothing) //4
   echo "<td class='back'><img title='$clothing[info_name]' src='../images/inventory/items/body_inventory/$clothing_n.png' /></td>";
if($animal) //5
   echo "<td class='back'><img title='$animal[info_name]' src='../images/inventory/items/body_inventory/$animal_n.png' /></td>";
if($pants) //6
   echo "<td class='back'><img title='$pants[info_name]' src='../images/inventory/items/body_inventory/$pants_n.png' /></td>";
if($shoes) //7
   echo "<td class='back'><img title='$shoes[info_name]' src='../images/inventory/items/body_inventory/$shoes_n.png' /></td>";

   /*
      <td><img title="<?php echo $n_item; ?>" src="../images/inventory/items/body_inventory/<?php echo $info['helmet_spot']; ?>.png" /></td>
      <td><img title="<?php echo $n_item; ?>" src="../images/inventory/items/body_inventory/<?php echo $info['amulet_spot']; ?>.png" /></td>
      <td><img title="<?php echo $n_item; ?>" src="../images/inventory/items/body_inventory/<?php echo $info['clothing_spot']; ?>.png" /></td>
      <td><img title="<?php echo $n_item; ?>" src="../images/inventory/items/body_inventory/<?php echo $info['animal_spot']; ?>.png" /></td>
      <td><img title="<?php echo $n_item; ?>" src="../images/inventory/items/body_inventory/<?php echo $info['pants_spot']; ?>.png" /></td>
      <td><img title="<?php echo $n_item; ?>" src="../images/inventory/items/body_inventory/<?php echo $info['shoes_spot']; ?>.png" /></td>
      <td><img title="<?php echo $n_item; ?>" src="../images/inventory/items/body_inventory/<?php echo $info['produs_spot']; ?>.png" /></td>
   */
   ?>
   </tr>
</table>



Înapoi la “Librarii Javascript”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 2 vizitatori