Abdur Rahim
Abdur Rahim

Reputation: 4021

Executing post method after JS confirmation

I am using ASP .Net MVC 4 , razor

on a form , in submit action, i want to set a confirm dialog of javascript. if i click "Ok" post method will be executed. else will not. so i used:

<td ><input type="submit" value="Process" name="btnProcess" onclick="confirm('Proceed?')"/></td>

but after clicking cancel it is executing the controller. How do i do this?

Upvotes: 1

Views: 185

Answers (1)

karaxuna
karaxuna

Reputation: 26940

<td ><input type="submit" value="Process" name="btnProcess" onclick="return confirm('Proceed?')"/></td>

Upvotes: 3

Related Questions