Javascript asp.net中java脚本函数中参数列表后未捕获的语法错误:缺少)
这是我的代码隐藏代码。 每当我将一些数据传递给LoadPivot时,此方法代码工作正常,但每当我将完整数据传递给此方法时,它就会给我错误 我试图传递的Json字符串长度是10666492 那么,有没有可以传递给java脚本方法的最大字符Javascript asp.net中java脚本函数中参数列表后未捕获的语法错误:缺少),javascript,c#,asp.net,Javascript,C#,Asp.net,这是我的代码隐藏代码。 每当我将一些数据传递给LoadPivot时,此方法代码工作正常,但每当我将完整数据传递给此方法时,它就会给我错误 我试图传递的Json字符串长度是10666492 那么,有没有可以传递给java脚本方法的最大字符 protected void Page_Load(object sender, EventArgs e) { DataSet JsonDataset = PivotDataset; String JsonConfig = PivotConfig;
protected void Page_Load(object sender, EventArgs e)
{
DataSet JsonDataset = PivotDataset;
String JsonConfig = PivotConfig;
String jsonDS = JsonConvert.SerializeObject((JsonDataset.Tables[0]));
//Facing Problem Here.
jsonDS variable has huge data due to that whenever I pass some amount of data to this variable it works.
but whenever i pass all the data to the variable this is giving me error.
"Uncaught SyntaxError: missing ) after argument list."
String script = "window.onload = function() { LoadPivot('" + jsonDS + "','" + JsonConfig + "'); };";
Page.ClientScript.RegisterStartupScript(this.GetType(), "LoadPivot", script, true);
}
根据@mjwills的评论,我已经检查了我的脚本&实际问题是我传递给javascript函数的数据 谢谢你的建议@mjwills 我在jsonDS变量中获取的数据包含在数据中,因此我的JSON对象没有正确创建
So conclusion is there was not a character length problem.
it was invalid data which was causing the problem.
当问题发生时,脚本的确切价值是什么?您的jsonDS或JsonConfig似乎是invalid@mjwills10666492是字符串的长度这些字符串中有1000多万个字符我并没有完全理解JS有效负载的意思?