javascript - Delete data after save inside modal bootstrap 3 -
I have 2 pb to solve the model in bootstrap 3 with my form
First of all : My data has been saved twice: Secondly, when I save a data, how to delete text and data within my data in input or if I reload the model
thanks
First: catagories.php ==> Call a Model
& lt; Style & gt; .model-dialog {width: 900px! Important; } & Lt; / Style & gt; & Lt; A data-toggle = "model" href = "& lt ;? php echo FILENAME_MANUFACTURERS_POPUP ;? & gt;" Data-target = "#mymodel" & gt; & Lt ;? Php echo osc_image (DIR_WS_ICONS. 'Create.gif', TEXT_CREATE)? & Gt; & Lt; / A & gt; & Lt ;! - Modal - & gt; & Lt; Div class = "modal fade" id = "mymodal" tabindex = "- 1" role = "dialog" aria-labelbedby = "myModalLabel" aria-hidden = "true" & gt; & Lt; Div class = "modal-dialog" & gt; & Lt; Div class = "modal-content" & gt; & Lt; Div class = "modal-body" & gt; & Lt; Div class = "te" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt ;! - /.modal-content - & gt; & Lt; / Div & gt; & Lt ;! - /.modal-dialog - & gt; & Lt; / Div & gt; & Lt ;! - /.modal - & gt; ** Second: In my model: manufacturers_popup.php ** & lt; Script src = "https://code.jquery.com/jquery-1.11.1.min.js" & gt; & Lt; / Script & gt; & Lt; Form name = "ajaxform" id = "ajaxform" action = "manufacturers_popup_ajax.php" method = "post" & gt; & Lt; Input & gt; ....... & lt; / Input & gt; & Lt; Text area & gt; ........ & lt; / Text field & gt; & Lt; / Form & gt; & Lt; Script type = "text / javascript" src = "ext / javascript / bootstrap / js / bootstrap_ajax_form.js" /> & Lt; / Script & gt; Third: My Ajax files: bootstrap_ajax_form.php $ (document) .ready (function () {$ ( ("# Simple-post") (function () {$ ("# ajaxform"). Submit (function (e) {$ ("# simple-msg") .html ("& lt; img src = 'Loading gif' / & gt; "); var PostData = $ (this) .serializeArray (); var formURL = $ (this) .attr (" action "); $ .ajax ({url: formURL, type:" POST ", data: postdata, success: function (data, textstate, jquxhr) {$ (" # -smple-msg ") .HTML ('& lt; pre & gt; code class =" very print "& gt; + Data + '& lt; / code & gt; Pre & lt; code & gt; & lt; code class = "prettypr Int "& gt; AJX;);} Error: function (jqXHR, text position, error triangle) {$ (" # simple-msg "). Html request failed & lt; br / & Gt; textStatus = '+ textStatus +', errorThrown = '+ errorThrown +' & lt; / code & gt; & lt; / pre & gt; ');}}); e.preventDefault (); // Default action e nickel ();}); $ ("# Ajaxform") submission () .; //submit form }); });
There are many things wrong here.
A submitting handler will bind to submit the form, you do not need to do it under a click handler for the submit button.
You do not want to trigger you to submit the way you are doing, this is the second one being saved
Comments
Post a Comment