How to redirect to action from JavaScript method?

前端 未结 8 1983
孤城傲影
孤城傲影 2020-12-25 11:12

I have an input type=\"button\"


8条回答
  •  旧巷少年郎
    2020-12-25 12:17

    Maybe better to make an anchor with DeleteJob url instead of button?

    " onclick="return DeleteJob()">Löschen
    

    and use your javascript you wrote already:

    function DeleteJob() {
    
            if (confirm("Do you really want to delete selected job/s?"))
                return true;
            else
                return false;
        }
    

    So if function return true - you will be redirected. If function return false - you still stay on the page.

提交回复
热议问题