JSFiddle - React, Tailwind, and code Playground

by mukkaram waheed

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<form action="" id="myformID">
	<input type="text" name="first">
	<input type="submit" name="Send">
</form>

JavaScript

$(document).ready(function($){
        $("form#myformID").on( "submit", function(event){
            event.preventDefault();
            event.stopPropagation();

            // Get some values from elements on the page:
            var $form = $( this ),
                $data = {
                    FirstName: $form.find( "input[name='first']" ).val()
                },
                url = ( "" );

            // Send the data using post
            var posting = $.post( "http://hopenotout.pk/sp1/index.php/Book/tets", $data );

            posting.done(function( data ) {
                //Do whatever you need with the returned data here.
                console.log(data);
                alert(data);
            });

        });
    });