function postdata(url, data, callback) {
$.ajax({
url: '/status',
type: 'POST',
dataType: 'json',
data: data,
success: function (received) { callback(received); }
});
}
var statusform;
(function(pub) {
var status = ""
pub.init = init;
function init() {
$('#new-status form').submit(function(e) {
submitdata();
e.preventDefault();
});
}
function submitdata() {
var data = {
text: getfieldvalue("textarea")
};
if (!data.text) { return; }
postdata("/status", data, function(received) {
status = received.status;
drawscreen();
});
}
function getfieldvalue(fieldname) {
return $('#new-status').find(fieldname).val();
}
function drawscreen() {
if (status) {
$('#statuses').append('<li>' + status + '</li>');
$('#new-status').find('textarea').val('');
status = "";
}
}
}) (statusform);
$(document).onload(statusform.init);
Note 1: This code sample is untested, but should give a good enough idea what I am trying to do.
Note 2: For extra type safety, use typescript interfaces to model data.
The points you mention should be open to debate, based on open and truthful information.
And if the points of view are so incompatible that no reasonable solution is possible maybe we should go our different ways. Why not have state without police. There are states or countries with little to none taxes, or villages where you can walk around nude.
But if we keep going into the direction we are going now, things will become very grim. One way or another a side will try to force their opinion upon others. And the price the other side has to pay could be unrealistically high. You cannot ask someone to starve to death for your sense of safety.