function addRow() {
	$("#addRowBtn").button("loading");

	var tableLength = $("#productTable tbody tr").length;

	var tableRow;
	var arrayNumber;
	var count;

	if(tableLength > 0) {		
		tableRow = $("#productTable tbody tr:last").attr('id');
		arrayNumber = $("#productTable tbody tr:last").attr('class');
		count = tableRow.substring(3);	
		count = Number(count) + 1;
		arrayNumber = Number(arrayNumber) + 1;					
	} else {
		// no table row
		count = 1;
		arrayNumber = 0;
	}

	$.ajax({
		url: 'php_action/fetchProductData159.php',
		type: 'post',
		dataType: 'json',
		success:function(response) {
			$("#addRowBtn").button("reset");			

			var tr = '<tr id="row'+count+'" class="'+arrayNumber+'">'+	

               '<td style="padding-left:20px;">'+
					'<div class="form-group">'+
					''+count+''+
					'</div>'+
				'</td>'+	
				
				

                '<td style="padding-left:20px;">'+
					'<div class="form-group">'+
					'<input type="text" name="inst_name[]" id="inst_name'+count+'" autocomplete="off" placeholder="Institution Name" class="form-control" />'+
					'</div>'+
				'</td>'+				

               						
			 '<td style="padding-left:20px;">'+
					'<div class="form-group">'+
					'<input type="text" name="edu_period[]" id="edu_period'+count+'" autocomplete="off" placeholder="Education Period" class="form-control" />'+
					'</div>'+
				'</td>'+	
				
			'<td style="padding-left:20px;">'+
					'<div class="form-group">'+
					'<textarea rows="3" cols="50" name="edu_desc[]" id="edu_desc'+count+'" autocomplete="off" class="form-control" /> </textarea>'+
					'</div>'+
				'</td>'+	
				
				
				'<td>'+
					'<button class="btn btn-default removeProductRowBtn" type="button" onclick="removeProductRow('+count+')"><i class="glyphicon glyphicon-trash"></i></button>'+
				'</td>'+
			'</tr>';
			if(tableLength > 0) {							
				$("#productTable tbody tr:last").after(tr);
			} else {				
				$("#productTable tbody").append(tr);
			}		

		} // /success
	});	// get the product data

} // /add row

function removeProductRow(row = null) {
	if(row) {
		$("#row"+row).remove();


		subAmount();
	} else {
		alert('error! Refresh the page again');
	}
}









