Sum Of Two Numbers

Posted on February 8, 2014 by Edit

Short and sweet application. On submitting the form a, b values are passed to self(same page) using GET method. On reload the JS fetches values of a & b from URL using getUrlParameter Method and computes there sum.

Output (A+B):


	var a = getUrlParameter("a");
	var b = getUrlParameter("b");
	if(a!="" && b!=""){
		if($.isNumeric(a) && $.isNumeric(b)){
			$("#output").html(+a + +b);
		else  $("#output").html("Enter only numbers.");
	else $("#output").html("Please fill the input and hit add button.");

Tags : js
This website is made possible by displaying online advertisements to our visitors.
Please consider supporting by disabling your ad blocker.

Get new posts by email:
loading comments...