javascript - Update data in mysql with html form inside jquery dialog -


i need in making page can see data mysql query. every row echoed div unique id.

<div class="column" id="<?php echo $row['id']; ?>"> 

it has same id data in mysql database. every div contains edit button:

<a href="edit_column.php?id=<?php echo $row['id'] ?>" class="edit">edit</a> 

after clicking 'edit', jquery script executed:

$('.edit').on('click', function() {             var url = this.href;             var dialog = $("#dialog");             if ($("#dialog").length == 0) {                 dialog = $('<div id="dialog" style="display:hidden"></div>').appendto('body');             }             dialog.load(                 url,                 {},                 function(responsetext, textstatus, xmlhttprequest) {                     dialog.dialog();                 }                 );             return false;         }) 

then, dialog box pops html form , managed put mysql data form edit it. don't know how continue. how should continue update data in database? know how update php , have php script update_column.php don't know how execute dialog box , refresh respective div element updated data without refreshing whole page in browser. in edit_column.php, have html form , php script returns data mysql database.

all have add event submit edit form on 1 of items in ajax form got first ajax call, have save edit id can save global var,

var editid; $('.edit').on('click', function() {         var url = this.href;         editid = $(this).attr('id');         var dialog = $("#dialog");         if ($("#dialog").length == 0) {             dialog = $('<div id="dialog" style="display:hidden"></div>').appendto('body');         }         dialog.load(             url,             {},             function(responsetext, textstatus, xmlhttprequest) {                 dialog.dialog();             }             );         return false;     });  /* event submit ajax form */     $('body').on('click', '#elementtosubmit', function() {       formdata = $('#ajaxform').serialize();       formdata.id = editid;       $.post('proccessedit.php', formdata, function(result) {// hiding modal or showing loading image        });     }); 

in php file 1 generate dynamic form specific id have this

<form id="ajaxform"> <!-- inputs --> </form> <!-- submit ajaxform --> <a id="elementtosubmit">save modifications</a> 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -