Link to home
Start Free TrialLog in
Avatar of WalterRR
WalterRR

asked on

Javascript Alert Box - catch click

Hi

I would like to catch the click of an alert box and reload location at this point. Currently I have reload at the end of the function which is not the desired behaviour


function myFunction(url, myuser, myprocessing){
	
    var xhr = $.ajax({
        "url": url,
        "data": { creatio: myuser, reqiu : myprocessing},
        "error": 
                function(jqXHR, textStatus, errorThrown) {
        				alert(jqXHR.responseText);     			
                
        },
        "success": 
            function(jqXHR, textStatus, errorThrown) {
    				alert("Success"); << ONCLICK of Alert... location.reload(); >>
    				
                    if($('#inspect-modal').data('modal').isShown == true) {
                    	$('#inspect-modal').modal('hide');
                    }
                    
            
    }
});
    location.reload(); <<remove this>>
}

Open in new window

Avatar of Mrunal
Mrunal
Flag of India image

Avatar of WalterRR
WalterRR

ASKER

Thanks for the reply...

The reason i wasn't using  a Confirm() was this is just a success message back to the user. There will be nothing to cancel. If I have a confirm() i don't think I can have this without the cancel button?

Maybe I have no option in this case?

W
ASKER CERTIFIED SOLUTION
Avatar of WalterRR
WalterRR

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the solution