Jump to content

jquery dialog post being duplicated


ploppy

Recommended Posts

Ths first time i make a post, the post submits fine. I then close the dialog window and click link to reopen and when i submit data again, it duplicates it and adds it twice. This behaviour just seems to keep adding a duplidcte each time. for example, post1 then post1+post1 then post1+post1+post1. Hope you get the idea. If someone could check my code, i would be grateful. Many thanks

 

// Feedback form

function feedbacknew() {

$("#fb_form").dialog({
autoOpen: false,
resizable: true,
modal: true,
title: 'Submit a feedback request',
width: 480,
beforeclose: function (event, ui) {
$("#fb_message").html("");


},
close: function (event, ui) {
$("#fb_message").html("");
$("#feedback").get(0).reset();
}

});

$('#fb_submit').click(function () {

var name = $('#fb_uname').val();
var client = $('#fb_client').val();
var department = $('#fb_department').val();
var email = $('#fb_email').val();
var position = $('#fb_position').val();
var feedback = $('#fb_feedbacknew').val();
var data = 'fb_uname=' + name +
'&fb_client=' + client +
'&fb_department=' + department +
'&fb_email=' + email +
'&fb_position=' + position +
'&fb_feedbacknew=' + feedback;
$.ajax({
type: "POST",
url: "feedback.php",
data: data,
success: function (data) {

$("#feedback").get(0).reset();
$('#fb_message').html(data);

//$("#form").dialog('close');
$("#flex1").flexReload();

},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);
}
});
return false;

});

$("#fb_form").dialog('open');

} 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.