How can i update form which is wrap within DIV tag using jquery/ajax call -
i can update total form jquey/ajax request how can update fields wrap within div. example:
<!-------------------------------------------------------------------------> <div class="update_certain_fields"> <table> <tr> <td>family name</td> <td><input type="text" name="fname" id="fname"/></td> </tr> <tr> <td>given name</td> <td><input type="text" name="gname" id="gname"/></td> </tr> </div> <!-------------------------------------------------------------------------> <tr> <td>email</td> <td><input type="text" name="email" id="email"/></td> </tr> <tr> <td>email private</td> <td><input type="text" name="pemail" id="pemail"/></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" value="save change" id="upload"/></td> </tr> </table> jquery file:
$('body').on('click', '#upload', function(e){ e.preventdefault(); var formdata = new formdata($(this).parents('form')[0]); var cid=$('#cdid').val(); $("#loading-image").show(); $.ajax({ url: 'editcontactdetails2.php', type: 'post', xhr: function() { var myxhr = $.ajaxsettings.xhr(); homecoming myxhr; }, success: function(data){ getdetails(cid); $("#loading-image").hide(); //hide loading $("#success").html(data); document.getelementbyid("all_contact_details").reset(); }, // complete: function(){ // $("#loading-image").hide(); //hide loading here //}, data: formdata, cache: false, contenttype: false, processdata: false }); }); so possible update fields wrap class=update ? can give me illustration ?
thank you.
there few issues markup:
firstly, nesting of div not proper.
secondly, event if utilize proper nesting, div cannot in table unless in td or th.
thirdly, please define exactly mean "i want update", otherwise you'll not have reply in generation.
therefore suggest away div , utilize traversal.
<table> <tr> <td>family name</td> <td><input type="text" name="fname" id="fname"/></td> </tr> <tr> <td>given name</td> <td><input type="text" name="gname" id="gname"/></td> </tr> <tr> <td>email</td> <td><input type="text" name="email" id="email"/></td> </tr> <tr> <td>email private</td> <td><input type="text" name="pemail" id="pemail"/></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" value="save change" id="submit"/></td> </tr> </table> </form> $('table').find('tr:lt(2)').find(':text') ...... jquery ajax
No comments:
Post a Comment