jQuery(document).ready(function( $ ) {
	$('#help-search-form').on('submit',function() {
		var query = $('#help-search').val();
		
			$('.tab-content').removeClass('active');
			$('#tab-search').addClass('active');
			$('.tab').removeClass('active');
			$('[data-target="#tab-search"]').addClass('active');

			$.ajax({ url: myAjax.ajaxurl,
				data: {action: 'search_iris_wordpress_help', sq : query },
				type: 'post',
				dataType : 'json',
				success: function(output) {
					$('#help-search-results').html('');
					$('#help-search-results').append("<table class='striped fixed widefat'><thead><tr><th width='25%'>Title</th><th>Description</th><th width='25%'>Categories</th></tr></thead><tbody></tbody></table>");
					if(output) {
						for(i in output) {
							var title = output[i].title;
							var description = output[i].description;
							var categories = output[i].categories;

							$('#help-search-results tbody').append("<tr><td class='row-title'><strong>"+title+"</strong></td><td>"+description+"</td><td>"+categories+"</td></tr>");
							
						}
					}
					if($.isEmptyObject(output)) {
					$('#help-search-results').html('Your search returned no results. Try making your search more general or contact Support.');
					}
				}
		   });
return false;
	});
	
	

$('#terms-and-conditions-submit').on('click',function() {
	$.ajax({ url: myAjax.ajaxurl,
		data: {action: 'submit_terms_and_conditions' },
		type: 'post',
		dataType : 'json',
		success: function() {
			$('.tb-close-icon').trigger('click');
			$('#terms-and-conditions-notice').remove();
		}
	});
});

	
	
});