javascript - Sending php generated form data via Ajax from Dialog box -
Hi guys, any help on this? I have a dialog box that is triggered with a button click on which my php script is called to create a form, which needs to be filled and submitted. I want to send and compose via Ajax and I have been reconstructing and research for a few days, but anything on StackExchange or other websites does not help me with this code here:
The dialog Box snippet;
$ k ('# CreateTable'). Click (function (e) {e.preventDefault (); var call = $ K ('# CreateTable'). Attr ('value'); // attr ('id'); var util = $ k (this) .attr ('id'); // etter ('id'), $ k ('# dialog'). Dialog ({autoOpen: false, title: 'Utility for': '+ call, model: true, width : 450, Closed: Function (Event, UI) {$ k ("#dialog"). Dialog ('deleted'); // event.target} / END CLOSE}). Dialog ('Open'); var utility = {'Utility': use}; $ k.ajax ({type: "post", url: "inc / runUtilities.php", datatype: "html", data: utility, success: work (data) {$ k ( '# DlgTxt') .html (data). FadeIn ('slow');}}); // Return Zhu ;;}); // end dialog PHP script Ippet;
$ show = "& Lt; form id = 'cContact' name = 'cContact' method = 'post' & gt;"; // action = ''. $ _ SERVER ['REQUEST_URI'] '' $ Show = '& Lt; Table alignment = "center" width = "425" range = "0" & gt; '; $ Query = "Show columns from". $ _ Session ['workable']. "` "; If ($ output = mysqli_query ($ this-> MySQLCxn- & gt; MySQLCxn, $ query)) {$ columns = array (); While ($ line = mysqli_fetch_assoc ($ output)) {If ($ line ['field'] == 'id') {} else $ show = '& Lt; Tr & gt; & Lt; Td width = "175" & gt; Div align = "right" & gt; '. $ Line ['field'] .: & lt; / Div & gt; & Lt; / Td> & Lt; Td width = "155" & gt; & Lt; Input type = "text" name = "'. @ $ Line [' field '].' 'Placeholder =' '. @ $ Line ['field']. "/" & Lt; / TD & gt; & Lt; Td width = "115" & gt; & Amp; Nbsp; & Lt; / Td> & Lt; / TR & gt; '; }} $ Show = '& Lt; Tr & gt; & Lt; Td> Submit & lt; / Td> & Lt; Td> & Lt; Button type = "button" id = "cContactSbmt" onclick = "doSubmitForm (this); return false;" Name = "cContactSbmt" value = "cContactSbmt" & gt; Create a contact & lt; / Button & gt; & Lt ;! - & lt; Input type = "submit" class = "button" value = "save" name = "submit" & gt; - & gt; & Lt; / TD & gt; & Lt; TD & gt; & Nbsp; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Form & gt; & Lt; Div id = "thank you" & gt; & Lt; / Div & gt; '; And I am currently using Jacuntie, on which I am being sent my fire on which the form is being sent.
var $ j = jQuery.noConflict (); (Function ($ j) {$ j (document) .ready (function () {$ j ("# cContactSbmt") Click (function (e) {// 'click', e.preventDefault (); alert ( 'Ccontactsbmt clicked ...'); $ j.ajax ({type: "POST", url: "inc / runUtilities.php", data: $ j (this). Serialize (), success: function (msg) { $ J ("# thanks"). HTML (msg) $ j (this) .modal ('hide');}, error: function () {warning ("failure")}}})}})}} ; }) ($ J);
For some reasons nothing is seen in the console again: I have a dialog box which is populated through Ajax which can be uploaded to another PHP script which can be processed To do and answer the dialogues. any suggestion?
Your output not php ("echo") is nothing. You need echo which you want to return to your AJAX-call
Update: Each success for debugging callback, for example:
Success: work (data) {console.log (data); }
Comments
Post a Comment