Reputation: 865
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
$(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
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
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.
Upvotes: 1