|
代码:
var tdata=this.comp("tempdata");
var returninfo=this.comp("resultdata");
returninfo.clear();
var bjData =this.comp("daijieshoudata").toJson({
format:'simple'
})['rows'];
var me=this;
var webinfo=this.comp("webdata");
var qingdanjson=JSON.stringify(bjData);
var uril="http://"+webinfo.getValue("webip")+"/"+webinfo.getValue("vname")+"/";
var huican=tdata.getValue("员工编码")+"$"+tdata.getValue("工位编码")+"$"+tdata.getValue("制造指示号")+"$"+qingdanjson;
debugger;
alert(huican);
alert(uril);
$.ajax({
"type" : "POST",
"async" : false,
"contentType": "application/json; charset=utf-8",
"data": "args="+huican,
"url" :uril+"shengchanguanli.asmx/jsgw3",
"cache" : false,
"dataType" : "jsonp",
"jsonp": "callbackjsp",//服务端用于接收callback调用的function名的参数
"jsonpCallback":"successCallback",
beforeSend: function(x) {
x.setRequestHeader("Content-Type", "application/json; charset=utf-8");
},
success: function(json) {
//将结果存到页面的data中,并刷新显示到界面。
//alert("ok");
var str=json.result;
var strs= JSON.parse(str);
json={"@type" : "table","test" : {"idColumnName" : "fid","idColumnType" : "String", },"rows" :strs };
returninfo.loadData(json,false);
returninfo.refreshData();
if(returninfo.count()>0&&returninfo.getValue("results")=="成功"&&returninfo.getValue("results")!==undefined)
{
alert(returninfo.getValue("results"));
me.close();
}
else
{
alert(returninfo.getValue("results"));
}
},
error: function(x, e) {
alert("错误:"+x.responseText);
}
});
};
在开发的测试环境(即电脑端)是没有问题的。但是采用模式1打包安装到手机上(华为荣耀6)上就报如下错误:message:invalid json primitive:args. staktrace:at system.web.script.serialization.javascriptobjectdeserializer.deserialize primitiveobject()\r\n at syste.web.script.serialization.javascriptobjectdeserializer.deserializeinternal(Int32 depth)\r\n at system.web.script.serialization.javascriptobjectdeserializer.basicdeserialize(strint input,int32 depthlimit,javascriptserializer serializer)\r\n at system.web.script.serialization.javascriptserializer.deserialize[T](string input)\r\n at system.web.script.services.resthandler.executewebservicecall(httpcontext context,webservicemethoddata methoddata),exceptiontype:system.argumentexception
请求大神指点,这个问题已经折腾我快一周了。在群里也没有人回复,谢谢谢谢。 |
|