ploppy Posted July 25, 2011 Share Posted July 25, 2011 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'); } Quote Link to comment https://forums.phpfreaks.com/topic/242733-jquery-dialog-post-being-duplicated/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.