If you click on the Refresh link in the index.php files jquery will load the textbox value as a dynamic content
index.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(document).ready(function(){ $("#display_box").load("load_data.php"); $("#refresh_button").click(function(){ $("#display_box").load("load_data.php"); }); }); </script> </head> <body> <div id="refresh_button" name="refresh_button">Refresh</div> <div id="display_box"></div> </body> </html> |
load_data.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
<script> var type_of_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; var length_needed = 8; var generated_string = ''; for (var i=0; i<length_needed; i++) { var random_num = Math.floor(Math.random() * type_of_chars.length); generated_string += type_of_chars.substring(random_num,random_num+1); } $("#name").val(generated_string); $("#country").val(generated_string); $("#state").val(generated_string); $("#city").val(generated_string); </script> <div style="background-color:#DADADA;width:243px;height:118px;padding:24px"> Name: <input type="text" value="" id="name"> <br/> Country: <input type="text" value="" id="country"><br/> State: <input type="text" value="" id="state"><br/> City: <input type="text" value="" id="city"><br/> </div> <br/> <div style="background-color:#DADADA;width:243px;height:118px;padding:24px"> static content<br/> static content<br/> static content<br/> static content<br/> static content<br/> static content<br/> </div |