HOW TO SUBMIT FORM USING JQUERY AFSOMALI

Qaybta Xirfada Sayniska iyo iwm

Moderators: Moderators, Junior Moderators

User avatar
afisoone
SomaliNet Super
SomaliNet Super
Posts: 5509
Joined: Wed Jul 22, 2009 9:46 pm
Location: We all want to become president even though Amisom controls Mogadishu

HOW TO SUBMIT FORM USING JQUERY AFSOMALI

Post by afisoone »


Index.html

Code: Select all

<html>
<body>
<form id="foomka" method="post" action="insert.php">
Firstname:<input type="text" name="first"> </br>
Lastname:<input type="text" name="last"></br>
<button id="submit">Xafid</button>
</form>
<div id="soodaabac">

</div>
<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript" src="insert.js">
</script>
</body>
</html>
insert.php

Code: Select all

<?php
mysql_connect("localhost","root","");
mysql_Select_db("test");

$firstname=$_POST['first'];
$lastname=$_POST['last'];

mysql_query("insert into personal(firstname,lastname)values('$firstname','$lastname')");
echo "successfully inserted";




?>
Insert.js

Code: Select all

$("#submit").click(function(){
  var sooqaad=$("#foomka :input").serializeArray();
  $.post($("#foomka").attr("action"),sooqaad, function(daabac){
         tirtir();
      $("#soodaabac").html(daabac)
    
    });
    $("#foomka").submit(function(){
       return false;
      
      });
      function tirtir()
      {
        $("#foomka :input").each(function(){
          $(this).val('');
          
          
          
          
          });
        
        
      }
  
  
  });
----------------------------------------
Author:
Saciid Afisoone----afisoone@yahoo.com
  • Similar Topics
    Replies
    Views
    Last post

Return to “Careers - Engineering, Science & Computers”