Paul Designer
Paul Designer

Reputation: 865

Jquery popup show and hide

I have a button once clicked shows a popup with a dark bg. I used some code i found on here and edited but it doesnt seem to show the pop up and brings up an error saying {"error": "Please use POST request"}

Can any one help? here is my demo

http://jsfiddle.net/6bZRA/

$(document).ready(function (e) {
    $("#login-link").click(function () {
        $("#login-container-popup").dialog();
        $(".login-popup-darkbg").show();
    });

    $(".login-popup-darkbg").click(function () {
        $("#login-container-popup").dialog('close');
        $(".login-popup-darkbg").fadeOut(1000);
    });
    $(document).on('click', '.ui-button-icon-primary', function () {
        $("#login-container-popup").dialog('close');
        $(".login-popup-darkbg").fadeOut(1000);
    });

});

Thanks

Paul

Upvotes: 1

Views: 9264

Answers (2)

secelite
secelite

Reputation: 1373

The {"error": "Please use POST request"} error is by jsfiddle because you are reloading the page by clicking the link.

Set the href to something like # or javascript:void(); to prevent this.

Upvotes: 0

Dhaval Marthak
Dhaval Marthak

Reputation: 17366

Try like this: May be this could help you:

$("#login-link").click(function (e) {
        e.preventDefault();
        $("#login-container-popup").dialog();
        $(".login-popup-darkbg").show();
    });

Use e in click event as it will prevent the default action to be fired of link.

Fiddle Demo

Upvotes: 1

Related Questions