javascript - When i use the window.close ajax call not working? -
i have small window in page when click button window value send controller , close window. when use window.close controller not hit. without window.close hits properly. need line close window.how manage that?
my sample code give below:
function click() {debugger; $.ajax({ type: 'post', url: 'my url' data: { status: $('#field_error')[0].checked }, datatype: 'json', success: function (data) { alert(data.message); } }); window.close(); } controller:
public actionresult actionname(bool status) {// not hit here }
call window.close inside success function
$.ajax({ type: 'post', url: 'my url' data: { status: $('#field_error')[0].checked }, datatype: 'json', success: function (data) { alert(data.message); window.close(); } }); ajax async in nature. not wait ajax complete. window.close called w/o completing ajax.
Comments
Post a Comment