Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $('#sbmt').click( function(){
- $.ajax({
- type: 'post',
- data: $("#ajxfrm").serialize(),
- url: "postdata.php",
- cache: false,
- success: function (data)
- {
- alert('updated table');
- }
- });
- });
- </script>
- <form id="ajxfrm" method="post" action="">
- <label>HIGH : </label> <input type="text" name="hi" id="hi"><br><br>
- <label>LOW : </label><input type="text" name="lo" id="lo"><br><br>
- <label>OPENING STOCK : </label><input type="text" name="opn" id="opn"><br><br>
- <label>CLOSING STOCK : </label><input type="text" name="cls" id="cls">
- <input type="submit" value="Submit" id="sbmt">
- </form>
- require_once 'config.php';
- $hi = $_POST['hi'];
- $lo = $_POST['lo'];
- $opn = $_POST['opn'];
- $cls = $_POST['cls'];
- echo $hi;
- $postdata = "INSERT INTO htmdem ( high,low,open,close ) VALUES('$hi','$lo','$opn','$cls');";
- mysql_query($postdata);
- jQuery(function($) {
- $('#ajxfrm').submit( function(e){
- $.ajax({
- type: 'post',
- data: $(this).serialize(),
- url: $(this).attr("action")
- })
- .done(function (data){
- alert('updated table');
- });
- e.preventDefault();
- });
- });
- <form id="ajxfrm" method="post" action="postdata.php">
- $('#ajxfrm').submit(function(event){
- $.ajax({
- type: 'post',
- data: $(this).serialize(),
- url: $(this).attr("action"),
- cache: false,
- success: function (data)
- {
- alert('updated table');
- }
- });
- return false; //to prevent form submission
- //or event.preventDefault();
- });
- $('#ajxfrm').submit(function(event){
- $.ajax({
- type: 'post',
- data: $(this).serialize(),
- url: $(this).attr("action")
- })
- .done(function (data){
- alert('updated table');
- });
- return false; //to prevent form submission
- //or event.preventDefault();
- });
- mysql_query($postdata) or die(mysql_error());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement