var req = new XMLHttpRequest();
function submitForm(form){
	req.form = {key:form.key.value,
		target:form.target.value,
		value:parseFloat(form.value.value)};

	var payload = JSON.stringify(req.form);

	req.onreadystatechange = parseResponse;

	req.open("POST", form.action, true);
	req.setRequestHeader('Content-Type', 'application/json');
	req.send(payload);
}

function parseResponse(){
	try{
		if(req.readyState === XMLHttpRequest.DONE){
			if(req.status === 200){
				console.log("---bridge's output start----");
				console.log(req.responseText);
				console.log("---bridge's output ends here-");
			}
		}
	}
	catch(e){
		document.write("Encountered Exception: "+e.message);
	}
}