Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery serialize

var datastring = $("#contactForm").serialize();
$.ajax({
    type: "POST",
    url: "your url.php",
    data: datastring,
    dataType: "json",
    success: function(data) {
        //var obj = jQuery.parseJSON(data); if the dataType is not specified as json uncomment this
        // do what ever you want with the server response
    },
    error: function() {
        alert('error handling here');
    }
});
Comment

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);
    });
  });
});
Comment

serializeobject jquery

$.fn.serializeObject = function()
{
   var o = {};
   var a = this.serializeArray();
   $.each(a, function() {
       if (o[this.name]) {
           if (!o[this.name].push) {
               o[this.name] = [o[this.name]];
           }
           o[this.name].push(this.value || '');
       } else {
           o[this.name] = this.value || '';
       }
   });
   return o;
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: material ui icon color 
Javascript :: FailedToParse: Password must be URL Encoded for mongodb: 
Javascript :: js escape url parameter 
Javascript :: react native activityindicator 
Javascript :: scrolltop top to bottom body get count 
Javascript :: forcechange input reactiveform 
Javascript :: usehistory 
Javascript :: javascript make beep sound 
Javascript :: javascript clear sembols 
Javascript :: yarn react select 
Javascript :: js download json 
Javascript :: axios file upload 
Javascript :: javascript getelementbyid disable 
Javascript :: google maps js on map load 
Javascript :: query date range in mongodb 
Javascript :: regex cpf javascript 
Javascript :: center horizontally react native 
Javascript :: javascript random letter generator 
Javascript :: min max and average finder in js array 
Javascript :: javascript remove space from string 
Javascript :: es6 
Javascript :: javascript onkeyup multiple classes 
Javascript :: pass only numbers in input react js 
Javascript :: slick slider infinite loop 
Javascript :: nodejs strict ssl false 
Javascript :: jquery get value name uploaded file 
Javascript :: TypeError: value.toLowerCase is not a function 
Javascript :: document load complete jquery 
Javascript :: Uncaught TypeError: this is undefined ApolloClient ApolloClient.ts:72 
Javascript :: GridStore is deprecated, and will be removed in a future version. Please use GridFSBucket instead 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =