/** * 获取数据ajax-get请求 * @author chanjunkai */ // var http_ip_prot = 'http://192.168.136.40:4696/' let domain = document.domain; // let http_ip_prot = 'http://192.168.136.40:7724/'; //生产环境 // let http_ip_prot = 'http://47.107.129.126:7724/'; var http_ip_prot = convertTemp()+ "/"; if( http_ip_prot.indexOf("zositech")==-1){ http_ip_prot = 'http://52.83.252.41:7724/'; // http_ip_prot="http://192.168.136.39:8000/"; // http_ip_prot = 'http://47.107.129.126:7724/'; // http_ip_prot = 'http://127.0.0.1:8000/' // http_ip_prot = 'http://192.168.136.40:7724/'; // let http_ip_prot = 'http://192.168.136.40:7724/'; console.log(http_ip_prot); }else{ console.log(http_ip_prot); } // http_ip_prot="http://192.168.136.39:8000/"; // 获取访问路径 function convertTemp(){    var the_url = document.location.toString();    var first_split = the_url.split("//");    var without_resource = first_split[1];    var second_split = without_resource.split("/");    var domain = second_split[0]; return first_split[0] +'//'+ domain; } $.GetJSON = function (url, data, callback) { $.ajax({ url: url, type: "get", contentType: "application/json", dataType: "json", timeout: 10000, data: data, success: function (data) { callback(data); } }); }; /** * 提交json数据的post请求 * @author laixm */ $.postJSON = function (url, data, callback) { $.ajax({ url: url, type: "post", contentType: "application/json", dataType: "json", data: data, timeout: 60000, success: function (msg) { callback(msg); }, error: function (xhr, textstatus, thrown) { } }); }; /** * 修改数据的ajax-put请求 * @author laixm */ $.putJSON = function (url, data, callback) { $.ajax({ url: url, type: "put", contentType: "application/json", dataType: "json", data: data, timeout: 20000, success: function (msg) { callback(msg); }, error: function (xhr, textstatus, thrown) { } }); }; /** * 删除数据的ajax-delete请求 * @author laixm */ $.deleteJSON = function (url, data, callback) { $.ajax({ url: url, type: "delete", contentType: "application/json", dataType: "json", data: data, success: function (msg) { callback(msg); }, error: function (xhr, textstatus, thrown) { } }); };