Reputation: 1140
I want to pass a string into my dialog like this:
('#buttonSaveRight').click(function () {
if (!ErrorHandlingSaveDialog()) {
return false;
}
var nr = "testdata1";
$("#dialogSaveConfirmation").data('param', nr).dialog('open');
return false;
});
and recieve it like this:
$('#dialogSaveConfirmation').dialog(
{
autoOpen: false,
modal: true,
width: "auto",
buttons: {
"Save": function () {
var nr= $('#dialogSaveConfirmation').data('param');
alert(nr); //this is just for testing if I recieved the data or not
//etc
What am I doing wrong? Is there some other way that I can pass data into my dialog?
Best regards Johan
Upvotes: 3
Views: 8550
Reputation: 9612
The above code is working fine on my end.
JS:-
$('#dialogSaveConfirmation').dialog({
autoOpen: false,
modal: true,
width: "auto",
buttons: {
"Save": function () {
var nr = $('#dialogSaveConfirmation').data('param');
alert(nr);
}
}});
$("#dialogSaveConfirmation").data('param', "asdsa").dialog('open');
Upvotes: 6