AJAX code to pass values by POST Method in Javascript.

        function datainsert(){
            var xmlhr = new XMLHttpRequest();
            var url = 'gethint.php';
            var fname = document.getElementById('fname').value;
            var lname = document.getElementById('lname').value;
            var vars = "firstname="+fname+"&lastname="+lname;
            xmlhr.open("POST",url,true);
            xmlhr.setRequestHeader("content-type","application/x-www-form-urlencoded");
            xmlhr.send(vars);
        }

Comments

Popular posts from this blog

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine