Hello everyone,

I have a cutsom function "initForms" who send forms with Ajax and
update my page content. That works great but events and effects
applied on the original page isn'nt re applied to the response
content.

In my original form page I have the folowing code :
== 8< ========================================================
$(function() {
                                
$("#dateOfBirth").makeBigCalendar().datepicker('option', {
                                        'maxDate'    : '+0',
                                        'yearRange'  : '-30:+0',
                                        'changeYear' : 'true',
                                        'defaultDate': '-10y'
                                });
});

And there is my form function :
== 8< ========================================================
function initForms() {
        $('form[action=\''+window.location.pathname+'\']').each(function(){
                var _form = $(this);
                _form.bind("submit", function(event){
                        event.preventDefault();
                        $.save();
                        $.ajax({
                                type: _form.attr('method'),
                                url:  _form.attr('action'),
                                data: _form.serialize(),
                                dataType: 'html',
                                success: function(response) {
                                        var _resp = 
$($(response).find("#content").html());
                                        $("#content").empty();
                                        $("#content").append(_resp);
                                        // Re apply all effects on the new 
content
                                        initPage();

                                        $.unblockUI();
                                }
                        });

                        return false;
                });
        });
}


When i submit the form, the server respond the same page with scripts,
menu etc.. so I remove these parts and retrieve only the #content and
finally I all initPage() who re apply all effects and
functionnalities.

But into the server respond there is also some scripts who are already
in the original form page. And I want to re apply theses scripts.
How can I achieve that ?
Is it a way to recall "ready()" on the document object or somtehing
other who allow me to re evalute my scripts ?

Thanks

Reply via email to