ajax - Simple form with jQuery UI dialog and databases -


I am programming an agenda, and I want to open a form inside a dialog box (jQuery UI modal form) And then enter the information in my database but I can not get an example of what I want to do.

I have collected some code but it does not work, I know that there are mistakes but I can not be correct because I'm new to jQuery and all this stuff

This is my code

  $ (function () {$ ("# dialog"). Delaag ("destroyed"); var libelle = $ ("# libelle "), Type = $ (" #type "), employe = $ (" # employe "), date = $ (" # date "), client = $ (" #client "), camion = $ (" #cmion "), Commentary = $ (" # commentator "), allfield = $ ([]) .add (libel) .add (type) .add ($ (" # dialog-form ") dialog ({autoOpen: false, Height: 450, width: 250, modal: adid) .add (customer) .add (camion) .add (comment); false, button: {'a scroller in a book': function () {$ (".jax") Submit (function (e) {var datas = $ (this) .serialize (); $ .ajax ({type: 'post', url: trettiment.fp, data: data, success: function (data)}}}}}; $ (this) .dialog ('pass'); }, Retor: function () {$ (this) .dialog ('close');}}, close: function () {allFields.val (''). RemoveClass ('UI-state-error');} }} $ ('# Create-user'). Click the button () (function () {$ ('# dialog-form'). Dialog ('open');});});  

and html

  & lt; Div class = "test" & gt; & Lt; Div id = "dialog-form" heading = "untouchable one tile" & gt; & Lt; Form & gt; & Lt; Fieldset & gt; & Lt; Label = "libelle" & gt; Libell & lt; / Label & gt; & Lt; Input type = "text" name = "libelle" id = "libelle" class = "text ui-widget-content ui-corner-all" /> & Lt; Label = "type" & gt; Type D RDV & lt; / Label & gt; & Lt; Select name = "type" id = "type" category = "text ui-widget-content ui-corner-all" /> & Lt; Option value = "Entretien"> Entretien & lt; / Options & gt; & Lt; Option value = "Depanense" & gt; Depanense & lt; / Option & gt; & Lt; Option value = "Kanji" & gt; Congestion & lt; / Options & gt; & Lt; / Select & gt; & Lt; Label = "employer" & gt; Jobs & lt; / Label & gt; & Lt; Select name = "id_empl" id = "id_empl" class = "selectbox ui-widget-content ui-corner-all" /> & Lt; Option value = "Entretien"> Entretien & lt; / Options & gt; & Lt; Option value = "Depanense" & gt; Depanense & lt; / Option & gt; & Lt; Option value = "Congress" & gt; Congestion & lt; / Options & gt; & Lt; / Select & gt; & Lt; Label = "date" & gt; Date & lt; / Label & gt; & Lt; Input type = "text" name = "date" id = "date" class = "text date picture ui-widget-content ui-corner-all" /> & Lt; Label = "client" & gt; Client & lt; / Label & gt; & Lt; Input type = "text" name = "client" id = "client" class = "text ui-widget-content ui-corner-all" /> & Lt; Label = "camion" & gt; Refinement Camion & lt; / Label & gt; & Lt; Input type = "checkbox" name = "camion" id = "camion" class = "text ui-widget-content ui-corner-all" /> & Lt; Label = "commentaire" & gt; Comment & lt; / Label & gt; & Lt; Textarea name = "commentaire" cols = "30" rows = "5" square = "text UI-widget-content ui-corner-all" & gt; & Lt; / Textarea & gt; & Lt; / Fieldset & gt; & Lt; / Form & gt; & Lt; / Div & gt; & Lt; Button ID = "Create-user" & gt; Ajoort One Button & lt; / Button & gt; & Lt; / Div & gt;  

I think you should take good care of jQuery's Ajax Post methods.

You can post the field as a field in a php page or something else.

A good plugin that you might like is a value plug-in:


Comments