[ Ïîèñê ] - [ Ïîëüçîâàòåëè ] - [ Êàëåíäàðü ]
Ïîëíàÿ Âåðñèÿ: Ajax â ÷åì ïðîáëåìà?
Ñòðàíèöû: 1, 2
Kela
Âåñü êîä
Ñêðûòûé òåêñò


$(function() {
$( document ).tooltip();
$( "#menu" ).buttonset();
$.post("shop.php",{server_id: gl_shop_server_id, cat_id: 'all'},function(data){
  $("#shop_body").html(data);
});
$("#radio1").click(function(){
  $.post("shop.php",{},function(data){
   $("#gl_shop_pay_btn").fadeOut(200);
   $("#gl_shop_clear_history_btn").fadeOut(200);
   $("#gl_shop_warehouse_msg").fadeOut(200);
   $("#shop_body").html(data);
   $("#gl_shop_server_list_panel").fadeIn(200);
   $("#gl_shop_category_panel").fadeIn(200);
  });
});
$("#radio2").click(function(){
  $.post("cart.php",{},function(data){
   $("#gl_shop_server_list_panel").fadeOut(200);
   $("#gl_shop_category_panel").fadeOut(200);
   $("#gl_shop_clear_history_btn").fadeOut(200);
   $("#gl_shop_warehouse_msg").fadeOut(200);
   $("#shop_body").html(data);
   $("#gl_shop_pay_btn").fadeIn(200);
  });
});
$("#radio3").click(function(){
  $.post("warehouse.php",{},function(data){
   $("#gl_shop_server_list_panel").fadeOut(200);
   $("#gl_shop_category_panel").fadeOut(200);
   $("#gl_shop_pay_btn").fadeOut(200);
   $("#gl_shop_clear_history_btn").fadeOut(200);
   $("#shop_body").html(data);
   $("#gl_shop_warehouse_msg").fadeIn(200);
  });
});

$("#radio4").click(function(){
  $.post("history.php",{},function(data){
   $("#gl_shop_server_list_panel").fadeOut(200);
   $("#gl_shop_category_panel").fadeOut(200);
   $("#gl_shop_pay_btn").fadeOut(200);
   $("#gl_shop_warehouse_msg").fadeOut(200);
   $("#shop_body").html(data);
   $("#gl_shop_clear_history_btn").fadeIn(200);
  });
});
        $("#gl_shop_server_list_btn, #gl_shop_category_btn")
            .button()
            .next()
                .button({
                    text: false,
                    icons: {
                        primary: "ui-icon-triangle-1-s"
                    }
                })
                .click(function() {
                    var menu = $( this ).parent().next().show().position({
                        my: "left top",
                        at: "left bottom",
                        of: this
                    });
                    $( document ).one( "click", function() {
                        menu.hide();
                    });
                    return false;
                })
                .parent()
                    .buttonset()
                    .next()
                        .hide()
                        .menu();
$("#gl_shop_server_list_btn").click(function() {
  $.post("shop.php",{server_id: '1'},function(data){
   $("#shop_body").html(data);
  });
})
$("#gl_shop_category_btn").click(function() {
  $.post("shop.php",{cat_id: 'all'},function(data){
   $("#shop_body").html(data);
  });
})
$(".gl_shop_select_server_btn").click(function(){
  var glserver = $(this).attr('glserver');
  $.post("shop.php",{server_id: glserver},function(data){
   $("#shop_body").html(data);
  });
});
$(".gl_shop_select_category_btn").click(function(){
  var glcat = $(this).attr('glcat');
  $.post("shop.php",{cat_id: glcat},function(data){
   $("#shop_body").html(data);
  });
});
$("#gl_shop_pay_btn").button().click(function( event ) {
  event.preventDefault();
  $.post("_ajax.php",{pageindex: "cart", action: "pay"},function(data){
   if(data=='wrong_balance') $( "#dialog-modal_wrong_balance" ).dialog( "open" );
   else {
    data = data.split(':');
    if(data[0]=='ok') {
     $("#gl_shop_user_balance").find("b").html(data[1]);
     $( "#dialog-modal_payet" ).dialog( "open" );
     $("#radio3").click();
    }
   }
  });
});
$("#gl_shop_clear_history_btn").button().click(function( event ) {
  event.preventDefault();
  $.post("_ajax.php",{pageindex: "history", action: "clear"},function(data){
   if(data=='ok') {
    $(".shop_list").html('<tr><td colspan="5"><br><br><br><center>Èñòîðèÿ ïóñòà!</center><br><br><br><br></td></tr>');
    $("#gl_shop_clear_history_btn").fadeOut('slow');
   }
  });
});
});




Ïîëíûé èíäåêñ:

Ñêðûòûé òåêñò


<?php
require_once 'config.php';

$_SESSION['gl_shop_server_id'] = $_SESSION['gl_shop_server_id_from_lc'];
$_SESSION['gl_shop_category_id'] = 'all';
$_SESSION['gl_shop_server_id_from_lc'] = '';
?>


<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<link rel="stylesheet" href="engine/modules/shop/images/index.css">
<script src="/GL/shop/images/index.js"></script>
<script>var gl_shop_server_id = '<?php echo $_SESSION['gl_shop_server_id']; ?>';</script>


<div id="shop">
<div class="gl_shop_hello_panel">
  <!--h1>Îíëàéí ìàãàçèí</h1-->
  <p>Çäðàâñòâóéòå <?php echo $gl_user_name; ?>, äîáðî ïîæàëîâàòü â îíëàéí ìàãàçèí!</p>
</div>
<div id="shop_header">
  <div id="menu">
          <input type="radio" id="radio1" name="radio" checked="checked"><label for="radio1">Ìàãàçèí</label>
          <input type="radio" id="radio2" name="radio"><label for="radio2">Êîðçèíà</label>
          <input type="radio" id="radio3" name="radio"><label for="radio3">Ñêëàä</label>
          <input type="radio" id="radio4" name="radio"><label for="radio4">Èñòîðèÿ</label>
  </div>
</div>


<div id="gl_shop_menu2">
  <?php if(count($gl_shop_server_list_query)>1) { ?>
  <div id="gl_shop_server_list_panel">
      <div>
          <button id="gl_shop_server_list_btn">Ñåðâåðû</button>
          <button id="gl_shop_get_server_list_btn">&nbsp;</button>
      </div>
      <ul>
    <?php
     for ($i=0; $i<=count($gl_shop_server_list_query)-1; $i++) {
      echo '<li><a href="javascript:void();" class="gl_shop_select_server_btn" glserver="'.$gl_shop_server_list_query[$i]['id'].'">'.$gl_shop_server_list_query[$i]['servername'].'</a></li>';
     }
    ?>
      </ul>
  </div>
  <?php } ?>
  <?php if(count($gl_shop_category_query)>0) { ?>
  <div id="gl_shop_category_panel">
      <div>
          <button id="gl_shop_category_btn">Ðàçäåëû</button>
          <button id="gl_shop_get_category_btn">&nbsp;</button>
      </div>
      <ul>
    <li><a href="javascript:void();" class="gl_shop_select_category_btn" glcat="all">Âñå ðàçäåëû</a></li>
    <?php
     for ($i=0; $i<=count($gl_shop_category_query)-1; $i++) {
      echo '<li><a href="javascript:void();" class="gl_shop_select_category_btn" glcat="'.$gl_shop_category_query[$i]['id'].'">'.$gl_shop_category_query[$i]['category'].'</a></li>';
     }
    ?>
      </ul>
  </div>
  <?php } ?>
  <button id="gl_shop_pay_btn">Îïëàòèòü</button>
  <button id="gl_shop_clear_history_btn">Î÷èñòèòü èñòîðèþ</button>
  <div id="gl_shop_warehouse_msg">Ïðåäìåòû õðàíÿòñÿ íà ñêëàäå<br> äî òåõ ïîð, ïîêà âû èõ íå çàáåðåòå â èãðå!</div>
  <div id="gl_shop_user_balance">Áàëàíñ: <b><?php echo $gl_user_balance; ?></b> <?php echo $currency; ?></div>
</div>
<div id="shop_body"></div>
</div>




 ÷åì ïðîáëåìà, íå ïåðåêëþ÷àåòñÿ??
Áûñòðûé îòâåò:

 Ãðàôè÷åñêèå ñìàéëèêè |  Ïîêàçûâàòü ïîäïèñü
Çäåñü ðàñïîëîæåíà ïîëíàÿ âåðñèÿ ýòîé ñòðàíèöû.
Invision Power Board © 2001-2024 Invision Power Services, Inc.