“jQuery Form Serialize Object” Réponses codées

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');
    }
});
Stupid Sheep

jQuery sérialiser les données de formulaire à l'objet

var data = {};
$(".form-selector").serializeArray().map(function(x){data[x.name] = x.value;}); 
Old-fashioned Orangutan

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);
    });
  });
});
Lonely Locust

Réponses similaires à “jQuery Form Serialize Object”

Questions similaires à “jQuery Form Serialize Object”

Plus de réponses similaires à “jQuery Form Serialize Object” dans JavaScript

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code