Web Analytics Made Easy -
StatCounter My javascript code not working - CodingForum

Announcement

Collapse
No announcement yet.

My javascript code not working

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • My javascript code not working

    My javascript code not working I dont get any errors but When I click submit button nothing happens I am fallowing a video tutorial I have watched twice but I cant find out what is wrong here

    This is index.php

    Code:
      <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <title>Title</title>
            <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
            <script type="text/javascript">
                function gonder() {
                 //   $('#sonuc').html("bekle");
                    $ajax({
                        type:"post",
                        url:"ajax.php",
                        data:$('ferman').serialize(),
                        success:function (msg) {
                            $('#sonuc').html(msg);
        
                        }
        
                    });
                }
        
            </script>
        </head>
        <body>
        <form  id="ferman">
        
            <input type="text" name="ad" >
            <input type="text" name="soyad" >
            <input type="button" value="gonder" onclick="gonder();">
        </form>
        <div id="sonuc"></div>
        </body>
        </html>
    this is ajax.php

    Code:
     <?php
        
        $ad=$_POST["ad"];
        $soyad=$_POST["soyad"];
        echo "ad $ad soyadınız $soyad";
        ?>

  • #2
    "#" seems to be missing here:
    Code:
    data:$('ferman').serialize(),

    Comment


    • #3
      Thank you friend

      Comment

      Working...
      X