Answers for "jquery get form data"

2

jquery get form data

$('form').serializeArray()
// gives 
// 	[ {"name":"foo","value":"1"},
//  {"name":"bar","value":"xxx"},
//  {"name":"this","value":"hi"} ]


// or 

$('form').serialize() // gives : "foo=1&bar=xxx&this=hi"
Posted by: Guest on January-25-2021
1

jquery form serialize object

$(function(){
  $('form').on('submit', function(e){
    e.preventDefault();
    $(this).serializeObject().done(function(o){
      if(window.console) console.log(o);
      var j = JSON.stringify(o);
      alert(j);
      //window.open("data:image/png;base64," + o.userfile.data);
    });
  });
});
Posted by: Guest on May-01-2020
1

javascript jquery get form field value

         $(document).ready(function(){
         
             $("#buttonSet").click(function () {
                 $("#txtBox").val("Amit");
                 $("input:radio").val(["male"]);
                 $("#buttonGet").removeAttr('disabled');
            });
             $("#buttonGet").click(function () {
                $("#result").html(
                    $("#txtBox").val() + "<br/>" +
                    $("input:radio[name=rd]:checked").val()
                );
            });
         });
Posted by: Guest on December-17-2020
-1

jquery form data

var fd = new FormData();    
fd.append( 'file', input.files[0] );

$.ajax({
  url: 'http://example.com/script.php',
  data: fd,
  processData: false,
  contentType: false,
  type: 'POST',
  success: function(data){
    alert(data);
  }
});
Posted by: Guest on September-24-2020
6

javascript get form data

<html>
    <form id="myForm">
        <input type="text" name="email" value="[email protected]">
    </form>
    <p id='text'></p>

    <script>
        window.setInterval(()=>{
            var myForm = document.getElementById('myForm');
            var text = document.getElementById('text');

            text.innerText = myForm.elements['email'].value;
        }, 1);
    </script>
</html>
Posted by: Guest on June-07-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language