开发者

JQuery - Ajax Working a Time

The first time I open the page, everything is running. I press the edit button to edit the subject, and div is showing. I am using CKeditor and first time i can edit my post. Then when i press edit button again, doesnt show ckeditor's div and textarea. Only show status div. And It wrote "succesfully".

Sorry for my english. I will use screenshoots... This is for First time to click edit button... First Image Link: http://img691.imageshack.us/img691/9671/adszyvs.png

And When i click submit button ...

is writting "Loading" then "succesfully" on background..

And When i click edit button again.... Only writting "succesfully"..

Second image Link: http://img812.imageshack.us/img812/7854/adsz2ke.png

My codes...

Submit Click Event

$('#duzenlekutusu input[type="submit"]').live("click",function(){
var id = $("#numara").val();
ders_kayit(id);
return false;
    })

Ajax codes:

function ders_kayit(id){
        $("#duzenlekutusu").ajaxStart(function(){
        $("#duzenlekutusu").html('Yükleniyor...');});
        var icerik = encodeURIComponent(CKEDITOR.instances.editor1.getData());
        $.ajax({
            type: "POST",
            url: "ders_duzenle.php",
            data: "icerik=" + icerik + "&vid=" + id ,
            scriptCharset: "utf-8" , contentType: "application/x-www-form-urlencoded;charset=utf-8",
            success: function(ajaxCevap){
                $('#duzenlekutusu').html(ajaxCevap);
                $("#duzenlekutusu").fadeOut("slow");
                $("#kapla").fadeOut("slow");
                        // Güncellemeden sonra son verileri çek
                        $("#bilgiler").html('Yükleniyor...');
                        ders_yukle(id);
                        return false;
                }   
            })
        return false;
    }       

ders_duzenle.php codes:

<body>
<?php
$vid = @$_GET["id"];
$sorgu = mysql_fetch_array(mysql_query("SELECT * FROM vilayetcografyasi WHERE ID = '$vid'"));
?>


<div class="adminmenu"><a href="#" class="apply"><img src="../resimler/onayla.png" alt="" /></a><a href="#" class开发者_如何转开发="editly"><img src="../resimler/duzenle.png" alt="" class="editly" /></a><a href="#" class="deletely"><img src="../resimler/sil.png" alt="" class="deletely" /></a></div>
<input type="hidden" id="numara" name="numara" value="<?php echo $sorgu["ID"];?>" />
<div class="baslik"><?php echo $sorgu["VilayetBaslik"];?></div>
<div class="icerik"><?php echo $sorgu["VilayetIcerik"];}?></div>
<script type="text/javascript">
CKEDITOR.replace("editor1");
$("a.bunudakapat").click(function(){
    $("#duzenlekutusu").hide();
    $("#kapla").val("").hide();
    })  
$("a.editly").live("click",function(){
    $("#kapla").show()
    var x = $("div.icerik").html();
    var oEditor = CKEDITOR.instances.editor1;
    oEditor.setData( x );
    //$("#editor1").val(x);
    $("#duzenlekutusu").show();
    })
</script>
</body>
</html>


Hard to see exactly what is going on, a JSFiddle would help if possible. From what I can see, perhaps the line:

 $('#duzenlekutusu').html(ajaxCevap); 

is causing issues and emptying out your window?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜