GIF89a php
Current File : /home/hencockfreshchic/public_html/admin.cpanel/js/saveSizeVariants.js
function saveSizeVariants(){
	var size_name=$("#size_name").val();
	var size_unit=$("#size_unit").val();


	if(size_name=="")
	{
		alert("Enter name of new size, Given name of size will show during product listing page");
		$("#size_name").focus();
		return false;
	}
	if(size_unit=="")
	{
		alert("Enter size measurement unit, Given measurement will show on website so please fill it carefully, otherwise UI on website may be impact");
		$("#size_unit").focus();
		return false;
	}
	

		if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
		} else {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange=function()
		{
		if (this.readyState==4 && this.status==200)
		{
		
			if(this.responseText==1)
			{
				alert("Added new size variant successfully");
				window.location.href = ("size_variants.php");
			}
			else if(this.responseText==2)
			{
				alert("Dear user, This size already exist in database, Please try again with different size variant");
				window.location.href = ("size_variants.php");
			}
			else if(this.responseText==0)
			{
				alert("Dear user, We are unable to save new size variant now, please contact to developers to resolve this issue");
			}
		}
		};			
		xmlhttp.open("GET","saveSizeVariants.php?size_name="+size_name+"&size_unit="+size_unit,true);
		xmlhttp.send();
}