If there is any failure of validation or database updation then our flag status will change to Failed. To this page we will be posting two parameters, id and mark ( as updated by user ).īefore the updation we will keep one flag to monitor the process. You can read more on div message layers here.īackend PHP Script to update the record ( display-ajax.php) After displaying the message we will hide this layer after some time. Based on the outcome of record updation we can display a failure or success message using this div layer. During process time we will display one wait image. We kept one div layer msgDsp to display all the messages. By using these two data we will prepare our string to send data to PHP script to update the record. ![]() To our Ajax function we will pass the id value and inside the Ajax function we will read the updated mark. Now there is no need to show again the edit button so we will hide the same.ĭocument.getElementById(sid).style.display = 'none' // Hide the edit button Now we fill the div tag with a input text box with default value of present mark and with a button to trigger updation process through Ajax.ĭocument.getElementById(id).style.backgroundColor = '#ffff00' // Add different color to backgroundĭocument.getElementById(id).innerHTML = ' ' // Add different color to backgroundĭocument.getElementById(id).style.display = 'inline' // show the details Var mark=document.getElementById(id).innerHTML // Read the present mark We read the present mark ( data ) of the record Inside this function we will create two more variables using this id data. With the click of Edit button we will post the id of the record ( same as div tag id ) to the JavaScript function edit_field(). $count="SELECT name,id,class,mark,sex FROM student LIMIT 10" Įcho " $row $row $row $row" Require "config.php" // MySQL connection string To manage the button we used same id with ‘s’ as prefix. Here the id of the div tag is the id of the student record ( which is unique ). Each student mark we kept in a separate div tag. ( you can extended as many numbers you want ). ![]() We have displayed our records by using Query and using SQL limit command to display only 10 records. ![]() Each record will have mark at right most column with one button to edit. We display the records in a tabular manner. JQuery This script is modifed by using JQuery.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |