Meteor equivalent of $_POST to get posted form data


#1

I have a form in meteor and i am wondering how i would get all the posted data like i would do in php using

$_POST

What would be meteors equivalent of $_POST


#2

The approach is very different in Meteor (and JavaScript in general). The tutorial explains it here:

Blaze: https://www.meteor.com/tutorials/blaze/forms-and-events
React: https://www.meteor.com/tutorials/react/forms-and-events
Angular: https://www.meteor.com/tutorials/angular/forms-and-events


#3

I serialized array https://api.jquery.com/serializeArray/

‘submit #er’: function(event){
event.preventDefault();
var names = event.target.names.value;
var examname = event.target.examname.value;
var classname = event.target.classname.value;
// var result = event.target.results.value;
var formData = $(’#er’).serializeArray();
console.log(formData);
}

This works well with dynamically created form fields.