本文介绍了Jquery在4.0中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我们正在将代码从.net 2.0迁移到.net 4.0。在迁移过程中,我们遇到了Jquery,ajax和jason函数的问题。 在.net 2.0中,代码使用下面的代码将数据集转换为xml stream = new MemoryStream(); writer = new XmlTextWriter(stream,Encoding.Unicode); ds.WriteXml(writer); int count =( int )stream.Length; byte [] arr = new byte [数]; stream.Seek( 0 ,SeekOrigin.Begin); stream.Read(arr, 0 ,count); UnicodeEncoding utf = new UnicodeEncoding(); return utf.GetString(arr).Trim(); } 在jquery中加载为xml.loadXMl(结果)。 我在.net 4.0中尝试相同的代码 只需将.d添加到 xml.loadXMl(result.d)。 警告它的值为null。 当我硬编码xml xml.loadXMl(硬编码的xml)因为它正在工作时e。当我打印result.d它很好但是为xml添加了一个额外的字符。 任何人都可以帮忙解决这个问题吗?解决方案 对不起,我不想读你的代码。关于jQuery与任何.NET版本一起使用的任何陈述不仅是不正确的,它们根本没有任何意义,表明你缺乏对Web原理如何工作的理解。 这个是因为jQuery是一个JavaScript库,JavasScripts不知道.NET,以及服务器端的任何实现细节。 反过来,您显示的源代码(我仍然需要查看它)与jQuery无关。我没有看到任何证据表明某些东西不起作用。如果你不了解其中的基础知识,任何功能都可以搞砸。 怎么办?无论如何,不​​要继续这个项目。首先,尝试从第一原理学习ASP.NET,HTTP,JavaScrip,jQuery。然后回到项目中。是的,我很认真。 -SA 我解决了以上问题问题。因为上面的代码片段在将数据集形成xml时添加了一个特殊的字符。我重写了代码而没有考虑编码。它工作正常。 string 结果; > 使用(StringWriter sw = new StringWriter()){ > ds.WriteXml(sw); > result = sw.ToString(); > } Hi ,We are migrating the code from .net 2.0 to .net 4.0.During migration we are having a problem at Jquery,ajax and jason function.In .net 2.0 the code was converting dataset to xml using below codestream = new MemoryStream(); writer = new XmlTextWriter(stream, Encoding.Unicode); ds.WriteXml(writer); int count = (int)stream.Length; byte[] arr = new byte[count]; stream.Seek(0, SeekOrigin.Begin); stream.Read(arr, 0, count); UnicodeEncoding utf = new UnicodeEncoding(); return utf.GetString(arr).Trim(); }in jquery it is loading as xml.loadXMl(result).When I try the same code in .net 4.0Just adding .d to xml.loadXMl(result.d).alerting the value it is coming as null.When I hard code that xml xml.loadXMl(hardcoded xml )as it is working fin e.Where as when I print result.d it is coming fine but adding an extra character to xml.Can any one help how to solve this? 解决方案 Sorry, I don''t event want to read your code. Any statements about jQuery working with any versions of .NET not just incorrect, they makes no sense at all and indicate your lack of understanding how Web works in principle.This is because jQuery is a JavaScript library, and JavasScripts "knows" nothing about .NET, as well as any implementation detail of the server-side in general.In turn, the source code you show (I still have to look at it) has nothing to do with jQuery. I see no evidence that something is not working. Any functionality can be screwed up if you don''t understand the very basics.What to do? Anyway, not to continue this project. First, try to learn how ASP.NET, HTTP, JavaScrip, jQuery work from first principles. Then come back to the project. Yes, I''m serious.—SAHi ,I solved the above issue..It was because of the above code snippet when forming dataset to xml adding an special character.I rewritten the code without considering encoding.It worked fine.string result;> using (StringWriter sw = new StringWriter()) {> ds.WriteXml(sw);> result = sw.ToString();> } 这篇关于Jquery在4.0中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-24 19:12