Question: I want to ask confirm message when onclick

Here is my code:

```
$('#activate').click(function() { 
var url='<?php echo getStoreURL($_REQUEST['key']); ?>admin/email_tracker.php';
var key='<?php echo $data['api_key'];?>'

 $.post(url, {  key:key, activate:1 } );
 alert('Store activated');
 location.reload(true);
}); 

```

Here I need an alert box are you sure you want to active?. How to do it?. Thanks

Answer: 
Try this,

```
$('#activate').click(function() { 

  var url='<?php echo getStoreURL($_REQUEST['key']); ?>admin/email_tracker.php';
  var key='<?php echo $data['api_key'];?>'

  if(!confirm("Your message")){ return;  }

  $.post(url, {  key:key, activate:1 } );
  alert('Store activated');
  location.reload(true);
});

```

**[PROCEDURAL DEMO](http://jsfiddle.net/9BYHX/)**
**Try this:**

```
$('#activate').click(function() {
  var Confirm = confirm("Are you sure?");
  if (Confirm == true) {
    //put your function here
  }
});

```