我在custom.js上有以下Jquery代码
methodName: function (arg, arg2){
//equals to err in the `Meteor.call()`
if(arg !== 'something'){
throw new Meteor.Error('This is an error')
}
//insert new document
var docId = Somethings.insert({
fieldOne: arg,
fieldTwo: arg2
});
//send email to each subscriber. I don't know your exact DB fields so, its up to you. You did this in a different call.
var cursor = Subscribers.find();
cursor.forEach(function(ss){
//send email here. You can use each subscriber data like ss._id or ss.email. However you insert them...
});
//Equals to res in `Meteor.call()`. sends a result to the client side method call. inserted docId in this case
return docId
},
答案 0 :(得分:0)
感谢Andreas。这是我写的解决方案:
$(document).ready(function() {
changeParameters();
});
// change request param
function changeParameters() {
$('#pageSizeSelect, #sortBySelect').change(
function(evt) {
// ... function goes here
});
}
// End change request param