Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,355 members, 7,957,952 topics. Date: Wednesday, 25 September 2024 at 05:24 AM |
Nairaland Forum / Science/Technology / Programming / How To Change An Input Field Using Onchange Handler, And Submit (969 Views)
Check If Input Is Number Javascript / React Native Check Text Input Is Empty Or Not In Android / What Happen With EFCC Social Media Handler (2) (3) (4)
(1) (Reply)
How To Change An Input Field Using Onchange Handler, And Submit by kentc3: 1:55pm On Dec 01, 2016 |
Please, i need your help. I am new to jquery and am in need of it to achieve a task. Please help me out. Beow is a snippet of my code and what i intend to achieve below, after the snippet... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 1</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function (e) { $("#form".on('submit',(function(e) { e.preventDefault(); //$("#result".empty(); //$('#loading').show(); $.ajax({ url: "show.php", // Url to which the request is send type: "POST", // Type of request to be send, called as method data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values) contentType: false, // The content type used when sending data to the server. cache: false, // To unable request pages to be cached processData:false, // To send DOMDocument or non processed data file it is set to false success: function(data) // A function to be called if request succeeds { //$('#loading').hide(); $("#result".html(data); } }); })); }); </script> </head> <body> <div id="table"> <div id="result" style="background-color:red; height:20px; width:200px;"></div> <form method="post" action="" id="form" enctype="multipart/form-data"> <table style="width: 100%"> <tr> <td style="height: 25px; width: 88px">Amount</td> <td style="height: 25px"> <input name="name" style="width: 161px; height: 29px" type="text" id="name" placeholder="Input amount" onchange/><br/> </td> </tr> <tr> <td style="height: 25px; width: 88px"> calculate</td> <td style="height: 25px"> <input name="Text1" type="text" id="calculate"/> </td> </tr> <tr> <td style="height: 25px; width: 88px"> </td> <td style="height: 25px"> <input name="pwd" type="text" placeholder="Name"/> </td> </tr> <tr> <td style="width: 88px; height: 30px;"> </td> <td style="height: 30px"> <input style="width: 99px; height: 41px" type="submit" value="Register" name="submit" /></td> </tr> </table> </form> </div> </body> </html> What i intend to achieve is: Once the value in amount field changes, it goes to a .php page, calculate and display the result as a value in another input field called calculate. When the submit button is pressed, it moves the form to show.php, store in database, and output the result... I have tried different methods, but am finding it difficult displaying the values in an input field. Please i need your help.. Thanks |
(1) (Reply)
I Need A Tutor For Web Development And Programming / Apparent Extinction Of Windows 7 / How Do I Contact Google
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13 |