I have following code:
var bootboxresult;
bootbox.prompt('Please enter some data', function(result) {
if (result != null) {
bootboxresult = result;
}});
alert(bootboxresult);
if(bootboxresult === null)
{
return;
}
if(bootboxresult != null)
{
Some Code To Excecute
}
The code displays the prompt box, but always the content of the "bootboxresult" variable is null or undefined.
I need that the further code should wait for the bootbox.prompt() to store the value in the "bootboxresult" variable.
Please advise.
I think you can write all your code inside call back of bootbox. See example below.
var popup_content = "<b>Are you sure?</b><br><br>Do you want to delete?";
bootbox.confirm(popup_content, function(result) {
if(result){
// Write all your code here.
}else{
// else part code goes here
}
});