Passing variable to jQuery ui Dialog box
i need to pass a variable called 'test_var' to my dialog box but i don't know how to do that
how can i pass variable from my function that calls the dialog box to dialog box ?
//a tag calls to starter function and sends variable as parameter
<a href="#" onclick="starter(test_var)"> go </a>
//starter func recives the test_var and calls the dialog box
//what i want is to somehow send test_var to dialogbox in here
function starter(test_var){
//some stuff
$('#dialog_div').dialog('open');
return false;
}
}
$('#dialog_div').dialog({
aoutoOpen:false,
with:600,
buttons:{
"ok":function(){
// i want to be able to alert test_var in here
alert(test_var)
}
}
})
}
i've tried
function starter(test_var){
//some stuff
$('#dialog_div').dialog('open' , test_Val);
return false;
}
and
$('#dialog_div').dialog(test_v开发者_高级运维al , {//coode
})
but it doesn't work
Just make it a top level variable and then the dialog will have direct access to it.
精彩评论