Home:ALL Converter>My javascript code not working

My javascript code not working

Ask Time:2016-09-25T22:58:44         Author:ali ak

Json Formatter

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

<!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

<?php

$ad=$_POST["ad"];
$soyad=$_POST["soyad"];
echo "ad $ad soyadınız $soyad";
?>

Author:ali ak,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/39688289/my-javascript-code-not-working
Khallister :

It seems the main problem is here:\n\nFix\n\n$('ferman').serialize(),\n\n\nto\n\n$('#ferman').serialize(),\n\n\nIt's just simple mistake, really nothing to explain, considering that you used # id selector correctly on #sonuc.\n\nfunction gonder() {\n// $('#sonuc').html(\"bekle\");\n $.ajax({\n type:\"post\",\n url:\"ajax.php\",\n data:$('#ferman').serialize(),\n success:function (msg) {\n $('#sonuc').html(msg);\n }\n });\n}\n\n\nUpdate: As squint mentioned in the comments, and I missed it, there is a missing . in ajax call, should be $.ajax.\nThanks to squint to point that out anyway.\n\nNote: There is no need to change input type from button to submit while we are making an ajax call.\n\nCheers :)",
2016-09-25T15:00:12
yy