12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- var gis = gis || {};
- gis.script = function() {
- };
- gis.script.consolelog=function(t,o){
- //console.log(t,o);
- }
- gis.script.sqlProcessFailed=function(e){
- console.log('error',e.error.errorMsg);
- }
- /*
- * ajax封装函数
- */
- gis.script.jsonAjax= function(obj,exeJson){
- var ajaxInfo={
- type : 'post',
- dataType : 'json',
- //contentType : 'application/json;charset=utf-8',
- //timeout : 10000, //超时时间设置,单位毫秒
- cache : false,// 不从缓存中去数据
- async : true,
- //url : obj.url,
- //data : JSON.stringify(jsondate),
- //headers:headinfo,
- success : function(data) {
- if(exeJson){
- exeJson(data);
- }
- },
- error : function(jqXHR, textStatus, errorThrown) {
- //alert(jqXHR.responseText);
- }
- };
- ajaxInfo.url=obj.url;
- ajaxInfo.data=obj.data||{};
- if(typeof(obj.async)!="undefined"){
- ajaxInfo.async=obj.async
- }
- if(typeof(obj.contentType)!="undefined"){
- //alert(obj.contentType);
- ajaxInfo.contentType=obj.contentType;
- }
- //alert(ajaxInfo);
- $.ajax(ajaxInfo);
- }
- /*
- * 判断是数值
- */
- gis.script.isNum=function(value){
- if(typeof(value)!='undefined'){
- var result = true;
- var pattern = /^\d*(\.\d*)?$/;
- if (!pattern.test(value)) result = false;
- var num = parseFloat(value);
- if (isNaN(num)) result = false;
- return result;
- }
- return false;
- }
- /*
- * 判断是空字符串
- */
- gis.script.isBlank=function(value){
- if(value){
- value=value+"";
- for(var i=0; i<value.length; i++) {
- var c = value.charAt(i);
- if ((c!=' ')&&(c!='\n')&&(c!='\t')) return false;
- }
- }
- return true;
- }
- /*
- * 判断不是空字符串
- */
- gis.script.isNotBlank=function(value){
- if(typeof(value)!='undefined'){
- value=value+"";
- for(var i=0; i<value.length; i++) {
- var c = value.charAt(i);
- if ((c!=' ')&&(c!='\n')&&(c!='\t')) return true;
- }
- }
- return false;
- }
|