$(function(){ var base = "https://custproj00011-2.ceydz.com/front/" //鍓嶇紑 // var base = "http://192.168.3.8:8073/front/" //鏈湴 test() function GetQueryString(_data) {//鎷嗗垎浼犻€掑弬鏁? var temp = _data.split('?') if(temp.length >1){ newData = temp[1].split('=')[1] return newData }else{ console.log("鏃犲弬鏁?); return false } } function test(){ var tempD = window.document.location.href; var tempID = GetQueryString(tempD) if(tempID == false){ return } dz_ajax(base + 'sxjgaz/getNew', { "id":tempID }, "GET") .then(function(res){ if(res!== undefined){ listCallback(res) } }) .catch(function(err) { console.log(err); }) } function listCallback(_data){ // if() var sideData = _data.content var newName = sideData.name $("#dz_content_top").html( "

"+ newName +"

鍒嗙被:"+ sideData.classification+"   浣滆€匉 "+ sideData.author+"鏉ユ簮:"+sideData.createUser+" 鍙戝竷鏃堕棿:"+ sideData.createTime+"
" ) $("title").html(newName); console.log( $("title")); $("#dz_content_bot").html( sideData.other ) } function dz_ajax(url, params, type) {//AJAX,璺緞锛屽弬鏁帮紝绫诲瀷 return new Promise(function(resolve, reject) { $.ajax({ type: type || "post", url: url, headers: { 'content-type': 'application/json' }, dataType: 'json', data: params || {}, success: function(data) { if (data.code == 200 || data.rows) { resolve(data) } else { console.log(data.msg); reject() } }, error: function(e) { console.log(e) alert('缃戠粶寮傚父'); reject() } }); }).catch(function(e){}) } })