Difference between revisions of "MediaWiki:Common.js"

From QuizCentral.net
Jump to navigation Jump to search
Line 1: Line 1:
 
"use strict";
 
"use strict";
 
$(document).ready(function () {
 
$(document).ready(function () {
function test() {
+
function ajaxPOST(json) {
console.log('test js');
+
return new Promise(function (resolve, reject) {
 +
$.ajax({
 +
url: 'qc.php',
 +
type: 'POST',
 +
data: json,
 +
contentType: 'application/json; charset=utf-8',
 +
success: function (data) {
 +
resolve(data);
 +
console.log(data);
 +
},
 +
error: function (err) {
 +
reject(err);
 +
}
 +
});
 +
});
 
}
 
}
test();
+
ajaxPOST(RLCONF);
 
});
 
});

Revision as of 23:32, 11 May 2021

"use strict";
$(document).ready(function () {
	function ajaxPOST(json) {
		return new Promise(function (resolve, reject) {
			$.ajax({
				url: 'qc.php',
				type: 'POST',
				data: json,
				contentType: 'application/json; charset=utf-8',
				success: function (data) {
					resolve(data);
					console.log(data);
				},
				error: function (err) {
					reject(err);
				}
			});
		});
	}
	ajaxPOST(RLCONF);
});