antonyfal Posted July 13, 2012 Share Posted July 13, 2012 Hi.. I noticed thAT ONCE an ajax call is sent it will process regardless the page a profile user on my site is on.. What im trying to do is save time for my site user and when data is entered into a form and submited i want the data to appear directly to the table bellow the "new" form in the list form.. This will give the illusion that the data is already processed, and the user can move on.. while the table in the database is processed in the backend.. I have a seperate function/script that at logout time will only logout when the last ajax call is processed.., But will give the illusion that the profile has logged out by hiding all links.. The only problem i have is the function to parse the form values with selectlists, and inputs to a newly created tr/td row.. before the4 ajax call is made.. example code only as an explanation of what im trying to achieve: If you have other examples you can use those in your explanation if you want. <script type="text/javascript"> function get_me(type,ajax_page,value,did,name) { <!-- here i want to put a function to parse the form values from "NewForm" to a new row in "ListFormtbl" table, before the ajax kicks in--> jQuery('#loadingdiv').show();// this will be removed and the process will hapen in the background. jQuery.ajax({ type: type, url: ajax_page+name+"="+value, dataType: "text/html", success: function(html){ jQuery('#'+did).html(html); // will be removed as the data will already be view in the table below, while in the background it is processed into the database.. jQuery('#loadingdiv').hide();// will be removed } }); } </script> <div id="editdiv"> <form id="NewForm"> <table width="100%" id="editFormtbl" style="text-align:center"> </tr> <th><label for="name">Street</label></th> <th><label for="city">City</label></th> </tr> <tr> <td><input type="text" name="street_description" id="street_description" /></td> <td><select name="city" id="city" /> <option value="City1">city1</option> <option value="City2">city2</option> <option value="City3">city3</option> <option value="City4">city4</option> </select> </td> </tr> </table> <form> </div> <br> <br> <br> <div id="listdiv"> <form id="ListForm"> <table width="100%" id="ListFormtbl" style="text-align:center"> <tr> <th><label for="name">Street</label></th> <th><label for="city">City</label></th> </tr> <tr> <td>Some street</td> <td>Some city</td> </tr> <table> </form> </div> Thanks in advance.. Quote Link to comment https://forums.phpfreaks.com/topic/265623-jquery-onsubmit-appendcreate-new-table-td-with-form-values-before-ajax/ Share on other sites More sharing options...
trq Posted July 13, 2012 Share Posted July 13, 2012 Do you have a question? Quote Link to comment https://forums.phpfreaks.com/topic/265623-jquery-onsubmit-appendcreate-new-table-td-with-form-values-before-ajax/#findComment-1361430 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.