我有一个jquery AJAX函数,它检索一些HTML标记并在页面上显示它.我还想显示返回此HTML的html代码.我四处寻找解决方案,但没找到任何解决方案.有人可以请帮助.非常感谢
$.post('get_news.php', $("#gifForm").serialize(), function(data) {
//Show HTML
$('#output').html(data);
//Show HTML code
$('#output_code').html(data);
});
Run Code Online (Sandbox Code Playgroud) 提前了解"只是因为提供能力并不能使它成为一个好主意"的警告......
从外观上看,OData兼容签名要求您返回IQueryable.
例如:
[Queryable]
public IQueryable<MyModel> Get()
{
return _repo.GetAll().AsQueryable();
}
Run Code Online (Sandbox Code Playgroud)
然而,最近和不近期的许多文章都将IQueryable描述为:
我的问题是:
你觉得IQueryable和OData的能力超重了上述问题吗?
在回答中,我希望人们谈论:
...像这样的东西.
背景:我不仅要问上面列出的项目.但也因为OData作为"行业标准"出售给我们,而不是工具箱中的工具.因此,实现这一点将从根本上改变我们的WebAPI调用(我目前工作的地方)的回报.我们必须从我们自己的IResult返回签名(这是非常有用的)转到IQueryable,它似乎有问题(但也可能最终有用).
IRESULT示例:
至少,我们的返回签名会发生巨大变化.并且,我被告知WebAPI调用实现OData不会通过将"C Instance"更改为"IQueryable Instance"(这是有道理的).
public interface IResult<C>
{
[JsonProperty(PropertyName = "hasErrors")]
bool HasErrors { get; }
[JsonProperty(PropertyName = "errors")]
IList<String> Errors { get; }
[JsonProperty(PropertyName = "instance")]
C Instance { get; set; }
}
Run Code Online (Sandbox Code Playgroud) 从我的Kendo ListView调用OData时出现以下异常:
"检测到具有不兼容类型的二元运算符.找到操作数类型'Edm.Guid'和'Edm.String'用于运算符类'Equal'"
解码过滤器:
$ filter = OrganizationId eq'4c2c1c1e-1838-42ca-b730-399816de85f8'
编码过滤器:
%24filter = OrganizationId + eq +%274c2c1c1e-1838-42ca-b730-399816de85f8%27
还有非必要的尝试这些过滤器:
$ filter = OrganizationId eq guid'4c2c1c1e-1838-42ca-b730-399816de85f8'
$ filter = OrganizationId eq cast('4c2c1c1e-1838-42ca-b730-399816de85f8',Edm.Guid)
MY WEB API CALL看起来像:
// GET: odata/Sites
[HttpGet]
[EnableQuery]
public IHttpActionResult GetSites(ODataQueryOptions<Site> queryOptions)
{
IQueryable<Site> sites = null;
try
{
queryOptions.Validate(_validationSettings);
sites = _siteService.GetAll().OrderBy(x => x.SiteName);
if (sites == null)
return NotFound();
}
catch (ODataException ex)
{
TraceHandler.TraceError(ex);
return BadRequest(ex.Message);
}
return Ok(sites);
}
Run Code Online (Sandbox Code Playgroud)
我的JAVASCRIPT KENDO DATASOURCE看起来像:
var dataSource = new …Run Code Online (Sandbox Code Playgroud) 我有一个.NETStandard库,需要通过配置环境添加(版本控制的)JSON 文件。诀窍是......我想看看是否可以设置项目文件(.proj)以与 Web.Config 文件相同的方式列出它们。
例如:
web.config 将在 Visual Studio 中以这种方式显示

它通过在 .PROJ 文件中执行以下操作来实现此目的:
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.ModelOffice.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Development.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Production.config">
<DependentUpon>Web.config</DependentUpon>
</None>
Run Code Online (Sandbox Code Playgroud)
所以,要明确的是...
但这在图书馆不起作用.NETStandard......
<None Include="appsettings.json" />
<None Include="appsettings.development.json">
<DependentUpon>appsettings.json</DependentUpon>
</None>
<None Include="appsettings.modeloffice.json">
<DependentUpon>appsettings.json</DependentUpon>
</None>
<None Include="appsettings.production.json">
<DependentUpon>appsettings.json</DependentUpon>
</None>
Run Code Online (Sandbox Code Playgroud) 以下JSON未反序列化.这显然是因为DECIMALS在保存JSON中.我该如何解决?
这个初始JSON来自服务器和IS VALID:
{
"AppropriationAmount": 25000000,
"AppropriationHours": 56300,
"ArrThreshold": 11,
"ClientKey": 24,
"Description": 'Find and incarcerate the escaped prisoner',
"DirectHours": 50000,
"EndDate": '3/31/2011',
"EngineeringHours": 4000,
"IndirectHours": 2000,
"Key": 1589,
"Number": '0',
"OtherHours": 300,
"ProductivityCurveType": 'BurnedEarned',
"ProjectManager": 'Doctor Who',
"ProjectName": 'Prisoner ZERO',
"StartDate": '5/1/2010'
}
Run Code Online (Sandbox Code Playgroud)
这个随后的JSON发送到服务器FAILS:
一旦用户编辑了表单,数据就被客户端序列化并发送回来......在尝试反序列化JSON时它(然后)失败.
{
"AppropriationAmount": 56300.00,
"AppropriationHours": 25000000.00,
"ArrThreshold": 11.00,
"ClientKey": ,
"Description": 'Find and incarcerate the escaped prisoner',
"DirectHours": 50000.00,
"EndDate": '3/31/2011',
"EngineeringHours": 4000.00,
"IndirectHours": 2000.00,
"Key": 1589,
"Number": '0',
"OtherHours": 300.00,
"ProductivityCurveType": 'BurnedEarned',
"ProjectManager": 'Doctor …Run Code Online (Sandbox Code Playgroud) 我下载的样本项目的最新释放的RequireJS.他们的文档暗示任何加载的内容都传递到相关函数的参数列表中(按相应的顺序).
所以我决定尝试一下......但它似乎没有用!
Firebug(网络标签)显示jQuery为正在加载:所以RequireJSobvioulsy成功完成了该部分Firebug (控制台选项卡)显示'$不是函数'我的问题是:为什么别名没有填充?
我的代码看起来像:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/require.js" type="text/javascript"></script>
<script type="text/javascript">
require(["scripts/jQuery/Core/jquery-1.7.2.min"], function ($) {
// jQuery is not passed-into the function, so the alias fails!
$(function () {
var stop = "";
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
他们的样本看起来像:
//Inside scripts/main.js
require(["some/module", "a.js", "b.js"], function(someModule) {
//...
});
Run Code Online (Sandbox Code Playgroud) 我尝试过其他在线建议没有成功.
所以...
我打开SharePoint对话框的功能会传递agrs到指定的option对象,如下所示:
设置对话:
这里没什么神奇的......
function openEmailDialog() {
var options = SP.UI.$create_DialogOptions(),
url = '../Pages/EmailDocument.aspx';
options.title = "Email Documents";
options.width = 1024;
options.height = 400;
options.allowMaximize = false;
options.url = url;
options.args = { DidYouGetThis: true };
SP.UI.ModalDialog.showModalDialog(options);
};
Run Code Online (Sandbox Code Playgroud)
下一个...
打开目标URL后,大多数在线示例建议使用以下JavaScript args从对话框中提取BACK,如下所示:
获取ARGS:
请记住,这是一个新页面中的JavaScript,它刚刚作为对话框打开...
$(document).ready(function () {
// This fails because "get_childDialog" doesn't exist
var args = SP.UI.ModalDialog.get_childDialog().get_args();
});
Run Code Online (Sandbox Code Playgroud)
这会失败,因为该SP.UI.ModalDialog对象没有任何get_childDialog功能.
我已经创建了一个CodeActivity,用于(自定义)构建定义.在执行其主要目的之前,此活动需要将位于服务器上的文件复制到/从"源目录","自定义文件夹"等位置复制到"放置目录"(等).
我所拥有的一些变量是有效路径,但其他变量显然是"相对路径"的占位符.但是,我需要物理服务器路径,以便我可以来回复制有用的项目.
我需要的东西:
当然,我可以将项目名称传递给活动(用于解析目的)......因为那只是'俗气'.
我的问题是:
我知道如何获得的一些事实:
这些项目有些用处,而其他项目......并非如此.除非,我可以使用它们来获取物理服务器路径.
BuildDirectory:
'F:\ bld\Builds\41\Test\Test_CustomActivity_CreateNuGetPackages'
BuildDetail.DropLocationRoot:
'$/Test/Drops'
...希望我有物理路径
BuildDetail.BuildController.CustomAssemblyPath:
'$/Test/BuildProcessTemplates'
...希望我有物理路径
SourcesDirectory:
'F:\ bld\Builds\41\Test\Test_CustomActivity_CreateNuGetPackages\src'
Workspace.Folders:
'F:\ bld\Builds\41\Test\Test_CustomActivity_CreateNuGetPackages\src\Test\NuGet.Research \net35'
我想要的一些例子:

更新:2015年
2月2 日 @Edward - 根据您的要求.下面是我想要完成的更详细的解释.

我有许多工作实体框架标量函数.但是,当我尝试通过标量函数返回'truthy'值时,我得到以下异常:
"ETC.Operations.DbClient.DbClient.Data.DbClientContext"类型上指定的方法"Boolean svfn_CanCloneDocument(Int32,System.String)"无法转换为LINQ to Entities存储表达式.
我试过将RETURN TYPE改为......
为什么这会失败?
打电话看起来像:
public IQueryable<ShakeoutDataItem> Query()
{
var uow = UnitOfWork as DbClientUnitOfWork;
var dbContext = UnitOfWork.DbContext as DbClientContext;
var query = (from document in dbContext.vDocumentStatus
join shakeout in uow.Shakeout on document.DocumentId equals shakeout.DocumentId
join shakeoutDetail in uow.ShakeoutDetail on shakeout.Id equals shakeoutDetail.ShakeoutId
join meter in uow.Meter on shakeoutDetail.MeterId equals meter.Id
join product in uow.Product on shakeout.ProductId equals product.Id into productLEFTJOIN
from product in productLEFTJOIN.DefaultIfEmpty()
// THIS …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用jQuery sortable,droppable和draggable来协同工作.我有3个列表:一个断点占位符; 报告行; 报告组.
用户应该能够:
我的问题是......
我无法让上面的2号工作
侧注:
我确实尝试为此创建一个jsFiddle,但无法让jsFiddle解析jQuery的UI文件...所以我必须在这里包含整个HTML页面....抱歉!
这是HTML:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>DragDrop Sample</title>
<link href="Includes/Css/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<script src="Includes/JavaScript/jQuery/Core/jquery-1.4.4.js" type="text/javascript"></script>
<script src="Includes/JavaScript/jQuery/ThirdPartyPlugIns/jquery.ui.core.js" type="text/javascript"></script>
<script src="Includes/JavaScript/jQuery/ThirdPartyPlugIns/jquery.ui.widget.js" type="text/javascript"></script>
<script src="Includes/JavaScript/jQuery/ThirdPartyPlugIns/jquery.ui.mouse.js" type="text/javascript"></script>
<script src="Includes/JavaScript/jQuery/ThirdPartyPlugIns/jquery.ui.draggable.js" type="text/javascript"></script>
<script src="Includes/JavaScript/jQuery/ThirdPartyPlugIns/jquery.ui.droppable.js" type="text/javascript"></script>
<script src="Includes/JavaScript/jQuery/ThirdPartyPlugIns/jquery.ui.sortable.js" type="text/javascript"></script>
<style type="text/css">
body
{
font-family: Arial;
font-size: 18px;
}
#myDiv
{
width: 500px;
}
.item
{
background-color: #DDDDDD;
border: solid 1px #777777;
margin: 2px;
width: 300px;
}
.breakPoint
{
background-color: #999966;
}
.placeHolder
{ …Run Code Online (Sandbox Code Playgroud)