summaryrefslogtreecommitdiffstats
path: root/static/functions/testing.js
blob: c38f4cfde3be88b4a148ebf02f0d2371ec7f1fbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$(document).ready(function() {
	$(".run").click(function(e) {
		e.preventDefault();
		var id = $(this).data("gazelle-id");
		var className = $(this).data("gazelle-class");
		var methodName = $(this).data("gazelle-method");

		var inputs = $("#method_params_" + id + " input");

		var params = {};
		$.each(inputs, function() {
			params[this.name] = $(this).val();
		});

		$("#method_results_" + id).hide();
		$.ajax({
			type : "POST",
			url : "testing.php?action=ajax_run_method",
			data : {
				"auth": authkey,
				"class": className,
				"method": methodName,
				"params" :  JSON.stringify(params)
			}
		}).done(function(response) {
			$("#method_results_" + id).html(response);
			$("#method_results_" + id).show();
		});

	});
});