• 05-01-2010, 15:23:10
    #1
    Üyeliği durduruldu
    Jquery POST için faydalı olacağını düşündüğüm bir kod paylaşmak istiyorum.
    jquery post mantığını anlamanıza yardımcı olacaktır
    index.php sayfası
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>jQuery ve AJAX işlemleri</title>
    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <script type="text/javascript">
    function gonder(){
    
    $("#sonuc").html("<img src='yukleniyor.gif' />");
    
    $.ajax({
    type:'POST',
    url:'ekle.php',
    data:$('#veri-formu').serialize(),
    success:function(cevap){
    	
    	$("#sonuc").html(cevap)
    
    }
    
    })
    
    }
    </script>
    
    </head>
    <body>
    <form id="veri-formu">
    <input name="yazi"/>
    <input type="button" onClick="gonder();" value="Gönder"/>
    </form>
    <div id="sonuc"></div>
    </body>
    </html>
    ekle.php sayfası
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style>
    .yaz{
    position:relative;
    top:25px;
    }
    .yazi{
    background:#FF0000;
    color:#FFFFFF;
    font-family:Arial, Helvetica, sans-serif;
    font-size:16px;
    }
    </style>
    </head>
    
    <body><?php
    
    
    $yazi=$_POST['yazi'];
    
    sleep(2);
    
    if($yazi==""){
    
    echo "<div class=\"yaz\"><center><span class=\"yazi\">Boş alan bırakmayınız</span></center></div>";
    
    }
    else
    {
    echo "<div class=\"yaz\"><center><span class=\"yazi\">Merhaba $yazi</span></center></div>";
    }
    
    ?>
    </body>
    </html>
    yükleniyor gif i


    son olarak burdaki adresten
    http://code.google.com/p/jqueryjs/do...s&downloadBtn=

    buna tıklayarak jquery indirin ismini jquery.js yapın hepsi aynı dizinde olsun
  • 02-05-2010, 10:28:07
    #2
    gercekten isime iyi yaradı cok tesekkurler
  • 25-05-2013, 17:54:03
    #3
    Teşekküerler hocam işime yaradı. Konuda baya eskiymiş bu arada .
  • 26-02-2014, 10:09:53
    #4
    Merhaba
    Alıntı
    <div id="sonuc"></div>
    seklinde sonucu aldıktan sonra bunu div'in bir sure sonra kendiliginden kapanmasını istiyorum
    bunun için ne yapmam lazım
  • 26-02-2014, 18:11:00
    #5
    SurucLu adlı üyeden alıntı: mesajı görüntüle
    Merhaba

    seklinde sonucu aldıktan sonra bunu div'in bir sure sonra kendiliginden kapanmasını istiyorum
    bunun için ne yapmam lazım
    <script>
    window.setTimeout(function(){document.getElementBy Id("sonuc").style.display="none";},3000)
    </script>