Template.ban.events ({
'click #saveprofile': function() {
var properties = {
ip: $('#ip').val(),
client_name: $('#clt_name').val(),
usage: $('#use').val(),
blocked_usage: $('#buse').val(),
};
Meteor.call('updatevalues',properties,function(err,result){
if(err)
{
console.log(err);
}
else
{
alert("update is done");
console.log("update is Done");
}
});
}
});
这是我的服务器端代码
updatevalues: function updatevalues(properties,callback){
var values1 = '';
var success = "success";
var fail = "fail";
if(properties.ip != '')
{
values1 = api_bans.update( { ip: properties.ip },{$set:{ ip:properties.ip,blocked_usage:properties.blocked_usage }});
}
if(values1 == "1")
{
console.log("SQL :"+values1);
return success;
}
else
{
return fail;
}
}