我的页面有一个标签:
<script id='header' src='/Templates/Shared/Header.tmpl.html' type='text/html'></script>
Firebug告诉我Firefox 5正在请求此资源.在HTML选项卡上,我可以导航到script元素并看到它包含/Template/Shared/Header.tmpl.html的内容.
但是,jQuery坚持脚本标记为空.$('#header').html()返回一个空字符串.我不明白为什么.
是的,我可以使用$ .get()加载文件并使用$('#header').html(data)来设置内容.然后我可以按照我的预期使用它.这显然会产生第二个请求,我想避免.
我一直在使用RavenDB两个小时,所以如果我错过了一些明显的东西,我会道歉.
我正在使用System.Uri类型的属性存储非规范化视图模型.Uri被序列化为一个字符串,我想这是可以的,但是当我加载文档时抛出这个异常:
Message=Could not cast or convert from System.String to System.Uri.
Source=Newtonsoft.Json
StackTrace:
at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Utilities\ConvertUtils.cs:line 267
at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Utilities\ConvertUtils.cs:line 244
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 544
Run Code Online (Sandbox Code Playgroud)