Well I have stumbled upon a weird problem.
First time I send the form the server recieves 1. If I send another without reloading the page it sends 2 exact same posts, if I send it again it sends 3 and so on. If I would to send 9 forms it would send 9 exact same posts on the last.
Here's my code:
$('#AskACounsel .btn-ask-question').bind("click", function (e) {
e.preventDefault();
var textbox = $('#AskACounselQuestion');
var question = textbox.val();
var product = textbox.data('productid');
if (question.length > 0) {
var params = { question: question, productid: product };
var url = '/FAQService/AddQuestion';
$.ajax({
url: url, success: function (result) {
var infoDiv = $('#AskACounselThankYouView .counsel-info').html(result.Message);
var backDiv = $('#AskACounselThankYouView .counsel-footer .btn-return');
if (result.Success) {
textbox.val("");
backDiv.hide();
} else {
backDiv.show();
}
$('#AskACounselDefaultView').hide();
$('#AskACounselThankYouView').show();
},
type: 'POST',
data: params
});
}
});