Your IP : 216.73.216.164


Current Path : /var/www/html/anwc/wp-content/plugins/eea-pricing/scripts/
Upload File :
Current File : /var/www/html/anwc/wp-content/plugins/eea-pricing/scripts/pricing_js.js

jQuery(document).ready(function(){
	//console.log('here');
	jQuery('.ssa-pricing-chk').click(function(){
		stat =  jQuery(this).attr('stat');
		if(stat != 'RAP')
		{
			id = jQuery(this).attr('id');
			reg_id = jQuery(this).attr('reg_id')
			if(!jQuery(this).is(':checked'))
			{
				jQuery.ajax({
					url: ssa_price_fr.path,
					data:{action:'update_registration',
							'qid' : id,
							'reg': reg_id
							},
					method: 'POST',
					success:function(res)
					{
						console.log(res);
					},
					error:function(err)
					{
						console.log(err);	
					}
				});
			}
		}
		else
		{
			alert('Options of this question can not be changed anymore');
			return false;
		}
	});
	jQuery('.ssa-pricing-radio').click(function(){
		stat =  jQuery(this).attr('stat');
		if(stat == 'RAP')
		{
			alert('Options of this question can not be changed anymore');
			return false;
		}
	});
	
	jQuery('.ssa-pricing-radio').change(function(){
		stat =  jQuery(this).attr('stat');
		nm = jQuery(this).attr('name');
		unchecked = jQuery('input[name="'+nm+'"].active-rad').attr('id');
		if(stat != 'RAP')
		{
		nm = jQuery(this).attr('name');
		checked= jQuery('input[name="'+nm+'"]:checked').attr('id');
		console.log(unchecked);
		jQuery('input[name="'+nm+'"]').removeClass('active-rad');
		jQuery(this).addClass('active-rad');
		//unchecked= jQuery('input[name="'+nm+'"]').not(':checked').attr('id');
	
		reg_id = jQuery(this).attr('reg_id')
		
			jQuery.ajax({
				url: ssa_price_fr.path,
				data:{action:'update_registration',
						'qid': unchecked,
						'reg': reg_id
						},
				method: 'POST',
				success:function(res)
				{
					console.log(res);
				},
				error:function(err)
				{
					console.log(err);	
				}
			});
		}
		
		
	})

});