0

On my controller I have this:

@Autowired
MessageSource messageSource;

@RequestMapping(value="/ftp/confirmRemove", method=RequestMethod.GET)
@ResponseBody 
public String getMyAjaxMessage() {
    return messageSource.getMessage("gen.confirm", new Object[] {}, new Locale("pt", "BR")); 
}

And, on my html I have this:

<script type="text/javascript">
    $().ready(function () {
        function confirm_delete() {
            $.get('confirmRemove', function(data) {
                return confirm(data);
            });
        }
    });     
</script>

The the page's button is:

<a th:href="@{/ftp/remove(id=${pojo.id})}" onclick="return confirm_delete()"> 
    <img width="20px" height="20px" alt="remove" th:src="@{/assets/img/delete.png}" />
</a>

The idea here is prevent the controller's remove to be executed unless there's a JavaScript confirmation by the user. The problem is that, despite firebug returns the proper message on its console, I can't get the confirmation pop-up to show.

What am I missing here?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
gtludwig
  • 5,411
  • 10
  • 64
  • 90

0 Answers0