0

I have an ajax call() to load some specific information about a product:

function fnShowDetProd(code, size) {    
    mod.open("GET", "control/_showdetailproduct.asp?cod="+code+"&size="+size, true);    
    mod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");    
    mod.onreadystatechange = function() {
        if (mod.readyState == 4) {          
            document.getElementById("showDetails").innerHTML = mod.responseText;            
        }
    };
    mod.send(null)  
}

I call this function in my row onClick event:

 fnMostDetProd(selectedRow[0], selectedRow[1]);

Where selectedRow[0] and [1] are parameters of the clicked line.

I'm wondering if it's that possible to add a jQuery effect like fadeIn() to show the information retrieved on showDetails element.

Using jQuery 1.8.3 and jQuery ui 1.10.1.

2 Answers2

1

How about this:

function fnShowDetProd(code, size) {    
    mod.open("GET", "control/_showdetailproduct.asp?cod="+code+"&size="+size, true);    
    mod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");    
    mod.onreadystatechange = function() {
    if (mod.readyState == 4) {          
        $("#showDetails").hide();
        $("#showDetails").html(mod.responseText);
        $("#showDetails").fadeIn();
    }
};
mod.send(null)
}
HaukurHaf
  • 13,522
  • 5
  • 44
  • 59
0

Here you go: http://jsfiddle.net/X5jUC/

Make your div hidden...

<div id="showDetails" style="display:none;"></div>

Then all you have to do is this...

$("#showDetails").html('replace this with your mod.responseText').fadeIn( 3000, function() {
    // Animation complete
});

3000 means it takes 3 seconds to fade in, nice and slow. Increase it or decrease it to your liking.

gfrobenius
  • 3,987
  • 8
  • 34
  • 66
  • Sure it does. This is basic jQuery, the fiddle show it works. We can figure it out. Show me your `div` code. – gfrobenius Jan 23 '14 at 00:15