J
J
jtag2017-07-19 20:44:21
JavaScript
jtag, 2017-07-19 20:44:21

How to stop following a url when submitting a form?

Now like this:

$(selector).on('click', function(e) {
    e.preventDefault();
    $.ajax({
       data: data,
       url: "/selectFromDb",
       method: "post"
    }); 
});

It is still not entirely clear if you just need to transfer data to the server, why do you need to specify a certain URL, because there is no need to go to another page?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
emp1re, 2017-07-19
@emp1re

selector is ? otherwise it wouldn’t go anywhere No, you don’t need to go anywhere, just send it to the url you need <a>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question