Reputation: 10713
I have this:
$('#my_form').submit(function () {
setTimeout(function () {
console.log('1');
$.ajax({
type: "GET",
url: "/CorrectUrl/CorrectUrl",
data: {},
success: function (data) {
console.log('2');
},
error: function (a, b, c) {
console.log(a);
}
});
}, 100);
});
And the url for the form is called and executed. The form returns value. But CorrectUrl isn't getting called. Why?
Upvotes: 0
Views: 157
Reputation: 219824
You need to stop the default action from occuring with preventDefault()
$('#my_form').submit(function (e) {
e.preventDefault();
Upvotes: 7