小编Jas*_*ler的帖子

脚本标记加载了type ="text/html"和src ="...",但被jQuery忽略

我的页面有一个标签:

    <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)来设置内容.然后我可以按照我的预期使用它.这显然会产生第二个请求,我想避免.

firefox jquery firebug header jquery-templates

5
推荐指数
1
解决办法
5311
查看次数

序列化/反序列化System.Uri

我一直在使用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)

serialization ravendb

2
推荐指数
1
解决办法
2415
查看次数