Jquery and live act wired but act ok after force refresh in IE

Posted by Y.G.J on Stack Overflow See other posts from Stack Overflow or by Y.G.J
Published on 2010-05-30T15:12:40Z Indexed on 2010/05/30 15:22 UTC
Read the original article Hit count: 900

hi guys - somthing is wrong with my code and i can't get what it is...

i have a div id = "personaltab" i have a form in side it to login the user with username and password. if success the jquery empty the div and puts in the form of the bidding.

if the user try to bid the other ajax that assign to the button is working but for some reason skips the empty and just adding the responded ajax to the div

i have checked that in IE and chrome and it is working fine in chrome here are my codes

$("#login").click(function() {
    var id = $("input#pid").val();
    var user = $("input#puser").val();
    var pass = $("input#ppass").val();
    var dataString = 'id='+ id + '&user='+ user + '&pass=' + pass;
    if (user == "") {
        alert("error");
        $("input#puser").focus();
        return false;
    }
    if (pass == "") {
        alert("error");
        $("input#ppass").focus();
        return false;
    }
    $.ajax({
        type: "POST",
        url: "loginpersonal.asp",
        data: dataString,
        success: function(msg)
        {
            if (msg=="False") {
                alert("error");
                $("#personaltab").show();
            }
            else {
                $("#personaltab").fadeOut("normal",function(){
                    $("#personaltab").empty();
                    $("#personaltab").append(msg);
                    $("#personaltab").slideDown();
                });

            }
        },
        error: function (XMLHttpRequest, textStatus, errorThrown)
        {
            alert('error');
        }
    });
return false;
});

$("#sendbid").live("click", function(){
    var startat = $("input[name=startat]").val();
    var sprice = $("input[name=sprice]").val();
    if (parseInt(sprice)<=parseInt(startat)) {
        alert("error");
        $("input[name=sprice]").focus();
        return false;
    }
    else {
        var payment = $("select[name=payment]").val();
        if ($('input[name=credit]').is(':checked') ){
            var credit = true;
        }
        var prodid = $("input[name=id]").val();
        var dataString = 'id='+ prodid + '&price='+ sprice + '&payment=' + payment + '&credit=' + credit;
        $.ajax({
            type: "POST",
            url: "loginpersonal.asp",
            data: dataString,
            success: function(msg)
            {
                $("#personaltab").empty();
                $("#personaltab").append(msg);
                $("#personaltab").show();
            },
            error: function (XMLHttpRequest, textStatus, errorThrown)
            {
                alert('error');
            }
        });
    }
return false;
});

© Stack Overflow or respective owner

Related posts about internet-explorer-8

Related posts about jquery-ajax