Display confirmation message before send ajax request

前端 未结 6 634
说谎
说谎 2021-01-02 16:28

I have written an ajax function where I want to display confirmation meeessage before submitting the form. How should I add with my condition. Below is my code.

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-02 17:08

    Maybe this exemple is what you need ?

    var r = confirm("Press a button!");
    if (r == true) {
        // Make your ajax call here
    } else {
        // He refused the confirmation
    }
    

    Call your confirm before ajax call ?

提交回复
热议问题