jquery - Formly: How to receive data in JSON? -
link: http://thrivingkings.com/read/formly-the-form-glamorizer-for-jquery
i making contact form using formly , wondering how send message server/ email address.
their example is:
<script> $(document).ready(function() { $('#contactinfo').formly({'theme':'dark'}, function(e) { $('.callback').html(e); }); }); </script> and say:
this time, setup callback function give data in url format. not safest method of transferring user data , should not used secure information. also, can change callback method .serializearray() receive data in json.
how you recieve data in json? understand saying using .serializearray() don't know how send data. don't have experience this.
thanks.
you'd send data server utalizing jquery post this:
var postdata = $("#contactinfo").serializearray(); $.post('ajax/test.html', postdata, function(returndata) { console.log(returndata); }, "json"); from http://api.jquery.com/jquery.post/
put path server endpoint, handles posted data in replacement of ajax/test.html.
i did assume #contactinfo form element.
i did use $.serializearray() create sendable json of form content, can see here http://api.jquery.com/serializearray/
Comments
Post a Comment