Use url() to generate absolute url in JavaScript files

This commit is contained in:
printempw 2017-07-12 22:19:23 +08:00
parent b5a857ef68
commit d9206e955d

View File

@ -302,7 +302,7 @@ function setTexture() {
} else { } else {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "./player/set", url: url('user/player/set'),
dataType: "json", dataType: "json",
data: { data: {
'pid': pid, 'pid': pid,
@ -329,7 +329,7 @@ $('body').on('change', '#preference', function() {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "./player/preference", url: url('user/player/preference'),
dataType: "json", dataType: "json",
data: { 'pid' : $(this).attr('pid'), 'preference' : $(this).val() }, data: { 'pid' : $(this).attr('pid'), 'preference' : $(this).val() },
success: function(json) { success: function(json) {
@ -362,7 +362,7 @@ function changePlayerName(pid, current_player_name) {
}).then(function(new_player_name) { }).then(function(new_player_name) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "./player/rename", url: url('user/player/rename'),
dataType: "json", dataType: "json",
data: { 'pid' : pid, 'new_player_name' : new_player_name }, data: { 'pid' : pid, 'new_player_name' : new_player_name },
success: function(json) { success: function(json) {
@ -421,7 +421,7 @@ function ajaxClearTexture(pid) {
Promise.resolve($.ajax({ Promise.resolve($.ajax({
type: 'POST', type: 'POST',
url: './player/texture/clear', url: url('user/player/texture/clear'),
dataType: 'json', dataType: 'json',
data: data data: data
})).then(json => { })).then(json => {
@ -441,7 +441,7 @@ function deletePlayer(pid) {
}).then(function() { }).then(function() {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "./player/delete", url: url('user/player/delete'),
dataType: "json", dataType: "json",
data: { 'pid' : pid }, data: { 'pid' : pid },
success: function(json) { success: function(json) {
@ -467,7 +467,7 @@ function deletePlayer(pid) {
function addNewPlayer() { function addNewPlayer() {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "./player/add", url: url('user/player/add'),
dataType: "json", dataType: "json",
data: { 'player_name' : $('#player_name').val() }, data: { 'player_name' : $('#player_name').val() },
success: function(json) { success: function(json) {