mercredi 16 décembre 2015

Grab Form Data as an Object

My goal is to contruct an object with data of my form.

After doing some googling, people suggested me to use serialize()

Now, I got this from my form data

_method=PUT&_token=rs8iLxwoJHSCj3Cc47jaP5gp8pO5lhGghF1WeDJQ&max_down=256&max_up=256&cpe_mac=000D6766F2F6&device_mac=503275AE7A69

Is there a way to convert that long string into an object ?

Is there a any other way to achieve this ?

Any direction on this will mean a lot to me !


I've tried

$( "form#editRateLimitForm" ).on( "submit", function( event ) {
      event.preventDefault();
      var serialize = $( this ).serialize() ; // Nothing printing out
      console.log(serialize); // _method=PUT&_token=rs8iLxwoJHSCj3Cc47jaP5gp8pO5lhGghF1WeDJQ&max_down=256&max_up=256&cpe_mac=000D6766F2F6&device_mac=503275AE7A69

    });



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire