JavaScript how to prevent close dailogbox pop up when close dialog and refresh

Hi it is very simple question, but I didn't find the answer fit in my situation.

In my jQuery dialog I have buttons which is update and close. User click 'update button' then on code behind I need to update in database then close. when user click the close button then I close the dialog. the dialog is load aspx page. I have two problems.

  1. The problem is if user click close button which run javascript window.close(). It will pop up the windows "Do you want to close window...."

  2. How can I refresh the parent page and close the dialog by clicking the 'update' button.

there is the code to load the dialog:

function openDialog(url, name, width, height) {

$("#dialog-box").load(url).dialog({       
    autoOpen: false,
    resizable: true,
    height: 425,
    width: 600,
    modal: true         
});

$('#dialog-box').dialog('open');

return false;



}

I tried to use $("#dialog-box").dialog("close"); in my function which is called in code behind. but it show the error.

there is my function

function RefreshParentAndClose() {

$("#dialog-box").dialog("close");
}

enter image description here

there is the code I load the dialog on parent page

<div id="dialog-box" title=" "></div>
<td width="33%" align="right"><asp:button id="btnSelect" runat="server" causesvalidation="False" text="Select Locations"
                    OnClientClick="javascript:return openDialog('popLocation.aspx','select',600,500);"    /></td>
Answer:1

Use below code for close

 $("#dialog-box").dialog( "close" ); 

and to refrsh on close use

 $("#dialog-box").dialog({
 close: function( event, ui ) {
  window.location.reload();
 }
 });
Answer:2

I am attempting to pass 2 arrays to a function that filters through array 1 by array 2, then returns the filtered results. I am not understanding why I am getting the error: "Uncaught TypeError: arr2....

I am attempting to pass 2 arrays to a function that filters through array 1 by array 2, then returns the filtered results. I am not understanding why I am getting the error: "Uncaught TypeError: arr2....

  1. array some function example
  2. array some function in java
  3. typescript array some function
  4. js array some function
  5. array some arrow function
  6. php array some function
  7. angular array some function
  8. some array related functions in php
  9. array.some is not a function
  10. javascript array some arrow function

I have a 10 x 10 board and a button (in the demo given below I've minimized that to 3 x 3 ). When users click on the button the system generates a random number 1 to 9. document.getElementById(...

I have a 10 x 10 board and a button (in the demo given below I've minimized that to 3 x 3 ). When users click on the button the system generates a random number 1 to 9. document.getElementById(...

I am trying to add br tag between the text in react. can you guys tell me how to add it. I tried adding br tag... but if I add I get tag in the browser. providng my code below. can you guys tell me ...

I am trying to add br tag between the text in react. can you guys tell me how to add it. I tried adding br tag... but if I add I get tag in the browser. providng my code below. can you guys tell me ...

I wrote a simple code to choose random name from four, using "random_word();" function and it doesn't work. It says:"undefined". Can anyone explain me why and help to fix it? Thanks for all help. var ...

I wrote a simple code to choose random name from four, using "random_word();" function and it doesn't work. It says:"undefined". Can anyone explain me why and help to fix it? Thanks for all help. var ...

  1. javascript function returning undefined
  2. javascript function returning function
  3. javascript function returning multiple values
  4. javascript function returning value
  5. javascript function returning boolean
  6. javascript function returning object
  7. javascript function returning promise
  8. javascript function returning array
  9. javascript function returning nan
  10. javascript function returning true or false
  11. javascript function returning another function
  12. javascript function returning two values
  13. javascript function returning 2 values
  14. javascript function returning int
  15. javascript function returning json
  16. javascript function returning a boolean value
  17. javascript function returning json object
  18. javascript function returning html
  19. javascript function returning undefined value
  20. javascript function returning integer