Reputation: 101
For the life of me I can't work out when the script wont execute when the Yes button is clicked?
Nothing recorded in Console.
Can someone help please?! :)
Fiddle is here: http://jsfiddle.net/MCam435/NYWg2/2/
HTML:
<div id="reqtalkdialog" title="Confirmation Required">
Would you like to request contact?
</div>
<div id="reqtalk100006" style="display:block"><a href="#" class="reqtalk" id="100006">
<span class="reqtalk_b"> + Talk </span></a></div>
jQuery:
$("#reqtalkdialog").dialog({
autoOpen: false,
modal: true,
buttons : {
"Yes" : function() {
var element = $(this);
var I = element.attr("id");
var info = 'id=' + I;
$.ajax({
type: "POST",
url: "resource/talkrequest.php",
data: info,
success: function(){}
});
$("#reqtalk"+I).hide();
$("#talking"+I).show();
return false;
$(this).dialog("close");
},
"Cancel" : function() {
$(this).dialog("close");
}
}
});
$(".reqtalk").on("click", function(e) {
e.preventDefault();
$("#reqtalkdialog").dialog("open");
});
Upvotes: 0
Views: 33
Reputation: 10329
You're returning false before closing the dialog.
Remove that line, and it works: http://jsfiddle.net/A6TbN/
$("#reqtalkdialog").dialog({
autoOpen: false,
modal: true,
buttons : {
"Yes" : function() {
var element = $(this);
var I = element.attr("id");
var info = 'id=' + I;
$.ajax({
type: "POST",
url: "resource/talkrequest.php",
data: info,
success: function(){}
});
$("#reqtalk"+I).hide();
$("#talking"+I).show();
// return false;
$(this).dialog("close");
},
"Cancel" : function() {
$(this).dialog("close");
}
}
});
$(".reqtalk").on("click", function(e) {
e.preventDefault();
$("#reqtalkdialog").dialog("open");
});
Upvotes: 2