Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlay and onBeforeLoad #994

Open
Redani opened this issue May 6, 2013 · 2 comments
Open

Overlay and onBeforeLoad #994

Redani opened this issue May 6, 2013 · 2 comments

Comments

@Redani
Copy link

Redani commented May 6, 2013

Hello guys, i've been struggling for few hours truing to find out why "onBeforeLoad" is executed first.
here is a sample of my code: the first time before the overlay loads, alert(1) is displayed first. but then it's the seconde alert with old "post" value which is displayed first...

Thank you so much for your help

var $ol;
$("#forums .edit, #forums .disapprove").live("click", function() {
    var post = $("#post-10001").find(".post").text();
    $ol = $(this);
    alert(1);

    $(this).overlay({
        target: "#overlay",
        load: true,
        onBeforeLoad: function() {
            alert(2 + post);
            this.getOverlay().find("#new-reply").val(post);
        }
    });
});

$("form.alter-post").validator().submit(function(e) {
    $ol.overlay().close(); // close the overlay

    $.ajax({
        ...
    });
    return e.preventDefault(); // prevent form submission
});
@alibby251
Copy link
Contributor

Hi Redani,

I think it would help if you could please try to get this into a JSFiddle (www.jsfiddle.net), so we can see this in action? From what I am seeing, I suspect an issue with how you've used $(this), and it's context - I think it would be really good to see this in action first though!

@Redani
Copy link
Author

Redani commented May 10, 2013

Hi Alex,
I didn't receive any notification, I just by chance checked the post :)
it's very complicated to put it in JSFiddle, but i ended up using ajax calls to retrieve the value of a variable.it's more reliable. but it remains a mystery! maybe it's a problem of $(this)!!

by the way, do you have any idea for the issue I have submitted regarding the validator??? :D
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants