views:

26

answers:

2

The Code

$.ajax({
    url: "get_portfolio_experience.php",
    success: function(html) {
        $("#inbox_content").html(html).hide().slideDown('slow');
    }
});

The content doesn't animate if i do not put a hide() before slideDown(). And if i put a hide() it doesn't show in IE. What should i do?

A: 

You should add a CSS style display: none; for #inbox_content and use this code:

$.ajax({ 
    url: "get_portfolio_experience.php", 
    success: function(html) {
        $("#inbox_content").html(html).slideToggle('slow'); 
    } 
});
infinity
Works in Mozilla, not in IE.
Sussagittikasusa
Check again, edited
infinity
It doesn't work in IE and in Mozilla it misaligns the whole div, god knows why that is happening.
Sussagittikasusa
Any idea how to work it? i'm stuck.
Sussagittikasusa
@Sussagittikasusa - do you have an example link? something else is going on here.
Nick Craver
$("#inbox_content").html(html) only works in both.But the other way round -In IE it slides down and then disappears.Could it have anything to do with what i'm returning through my get_portfolio_experience.php file? (Its got <input /> fields)
Sussagittikasusa
+1  A: 

First, let's shorten this down with .load() like this:

$("#inbox_content").load("get_portfolio_experience.php", function(html) {
  $(this).hide().slideDown('slow');
});

Now for the issues, your explanation of IE behaving weird is almost certainly caused by invalid markup. Check the response coming back, are there any unclosed or invalid tags? Check it with the W3C Validator here: http://validator.w3.org/

Nick Craver
<div class="cell"> <span id="skill_hide"></span> <input type="text" id="skill"/> </div> It looks pretty valid. <div class="cell"> <span id="experience_hide"></span> <input type="text" id="experience" maxlength="15"/> </div> <div class="cell"> <input type="text" id="description"/> <span onclick="update_skill()" class="send" > Update </span> </div>
Sussagittikasusa
@Sussagittikasusa - that's the *entire* markup coming down...and the page itself is valid to begin with? this is also important, since inserting even valid HTML into invalid is unpredictable.
Nick Craver
The main page has some validity issues...yes. So do you think that is the issue?
Sussagittikasusa
@Sussagittikasusa - It depends what they are, but eliminating them is definitely the best use of debugging time IMO...erratic behavior like what you describe with the animations is usually the result of an un-opened/closed tag somewhere and IE just won't tolerate it.
Nick Craver