Open main menu
Home
Random
Log in
Settings
About wiki
Terms and conditions of use
wiki
Search
Changes
← Older edit
Newer edit →
MediaWiki:Common.js
(view source)
Revision as of 22:16, 18 April 2018
879 bytes added
,
22:16, 18 April 2018
no edit summary
Line 70:
Line 70:
onSelect: function(lang){
onSelect: function(lang){
setCookie('lang', lang);
setCookie('lang', lang);
−
location.reload();
+
$.ajax({
+
url: 'api.php',
+
data: {
+
action: 'query',
+
meta: 'tokens',
+
format: 'json'
+
},
+
xhrFields: {
+
withCredentials: true
+
},
+
dataType: 'json'
+
}).done(function (data){
+
$.ajax({
+
url: 'api.php',
+
method: 'POST',
+
data: {
+
action: 'options',
+
format: 'json',
+
token: data.query.tokens.csrftoken,
+
optionname: 'language',
+
optionvalue: lang
+
},
+
xhrFields: {
+
withCredentials: true
+
},
+
dataType: 'json'
+
}).done(function (data){
+
location.reload(
);
+
});
+
}
);
}
}
});
});
});
});
Mark.wooff
Bureaucrats
,
Administrators
55
edits