jeudi 6 juin 2019

why i cant send data to .json format file by ajax

I'm making a simple server to send data to a .json file and resive that data from another page but i have problem how to store data in .json file

I used following code but didn't work

<script src="jquery/jquery-3.4.1.min.js"></script>

<script>

     var _lname = "x";
    var _fname = "y";
    var _mname = "x";
      $.ajax({
                type: "POST",
                url: "data.json",
                data: "{'lastName':'" + _lname + "','firstName':'" + _fname + "','middleName':'" + _mname + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function () {
                    }
                });

</script>

Aucun commentaire:

Enregistrer un commentaire