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
https://forums.phpfreaks.com/topic/242733-jquery-dialog-post-being-duplicated/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.