I've a page with a div that is updated via an AJAX call, like this:
<body>
    <div id="container">
        <div id="newinfo">
            <form id="selectform">
                Your name:<br>
                <input type="text" name="firstname"><br>
            </form> 
        </div>
    </div>
    <script>
        function reload_container() {
            $('#container').load('url/to/ajax/update');
            console.log($('#selectform').serialize());
        }
    </script>
</body>
The load response is identical (including the form id), but with differing contents.
If I run reload_container(); from the debug console in Firefox however the serialize() function is empty, but $('#selectform') does is defined.
I need the contents of the form however. I do not know why the $('#selectform') selector does work after the reload but serialize() does not. Any help is much appreciated.
Please note that the inputs of the form do contain the name-tag. jQuery serialize not working is not relevant.
Update: events that are bound to elements in the container do not work either after the load(). E.g. $('#newinfo').click(function(){alert('hi!'}); in the body load script. This is solved however by jQuery .live() vs .on() method for adding a click event after loading dynamic html
 
     
    