我得到以下代码:
$.ajax({
type: "POST",
async: false,
url: "CheckIdExist",
data: param,
success: function(result) {
if (result == true){
return false;
}
},
error: function(error) {
alert(error);
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
如果ajax返回值为true,则表单需要停止提交.
但它并没有停止提交表格.
请帮忙.
如果我尝试在我目前的数字与旋转摄像头plot3使用
while true; camorbit(0.9,-0.1); drawnow; end
Run Code Online (Sandbox Code Playgroud)
然后即使在8核MacPro上,旋转也会定期挂起一段时间(例子).
我可以顺利吗?
EDIT1:
虽然我的原始问题还没有解决方案,但我已经成功制作了一部具有getframe功能的更好的电影.但它不允许记录徒手旋转,并且在MATLAB2010b for Mac中非常错误.
%# fix wrong figure position in MATLAB2010b for Mac - depends on your layout
correctedPosition = get(gcf,'Position') + [21 -125 0 0];
fps = 60; sec = 10;
vidObj = VideoWriter('newfile.avi');
vidObj.Quality = 100;
vidObj.FrameRate = fps;
open(vidObj);
for i=1:fps*sec
camorbit(0.9,-0.1);
writeVideo(vidObj,getframe(gcf, correctedPosition));
end
close(vidObj);
Run Code Online (Sandbox Code Playgroud)
EDIT2:
我在MATLAB Central创建了一个类似的线程.
EDIT3:
您可以自己尝试下载我的一个数字.
我正在使用jquery datatables插件.
我只有一个直接的html表格布局.
<table class="display" id="contactsTable">
<thead>
<tr>
<th>Id</th>
<th>Email</th>
<th>Name</th>
<th>Phone</th>
<th>City</th>
<th>State</th>
<th>Arrival</th>
<th>Departure</th>
<th>Inserted</th>
<th>Check</th>
</tr>
</thead>
<tbody>
<tr>
<td>301</td>
<td>email address</td>
<td>Test</td>
<td></td>
<td></td>
<td></td>
<td>July 14 2011</td>
<td>July 23 2011</td>
<td>April 12 2011 07:05</td>
<td><input type="checkbox" name="selected[]" value="301" class="chkbox"/></td>
</tr>
<tr>
<td>300</td>
<td>email</td>
<td>Test</td>
<td></td>
<td></td>
<td></td>
<td>September 02 2011</td>
<td>September 10 2011</td>
<td>April 11 2011 12:01</td>
<td><input type="checkbox" name="selected[]" value="300" class="chkbox"/></td>
</tr>
Run Code Online (Sandbox Code Playgroud)
这是我的提交代码(只是临时).
<input id="submitButton" type="submit" value="Submit" onclick="test()" />
Run Code Online (Sandbox Code Playgroud)
我的javascript将复选框映射到数组.
function test() …Run Code Online (Sandbox Code Playgroud) 我正在尝试集成jquery完整的日历插件..我想禁用过去的日期进行选择..所以我只能选择从当前日期开始的日期.这怎么可能?如何过滤日期并指定条件.我是jquery的新手.
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
selectable: true,
selectHelper: true,
select: function(start, end, allDay) {
var title = prompt('Event Title:');
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
editable: true,
});
});
Run Code Online (Sandbox Code Playgroud) 我写了一个非常简单的插件,允许我使用0xffccaacss颜色的格式而不是'#ffccaa'(主要是为了避免编写引号 - 而且还允许通过简单地将其添加为整数来轻松修改颜色).
我正在实施$().xcss({}),但更愿意使用$().css({}).
如何扩展功能的$.fn.css功能,是否有任何需要注意的缺陷?
另外,我想我也想做同样的事情$.animate.
小提琴:http://jsfiddle.net/hB4R8/
// pugin wrapper
(function($){ $.fn.xcss = function(opts){
// loop through css color properties
$.each(['background', 'backgroundColor','background-color', 'color', 'borderColor','border-color'],function(i,v){
// if set as number (will be integer - not hex at this point)
// convert the value to `#ffccaa` format (adds padding if needed)
if(typeof opts[v] === 'number')
opts[v] = ('00000'+opts[v].toString(16)).replace(/.*([a-f\d]{6})$/,'#$1')
})
// run css funciton with modified options
this.css(opts) …Run Code Online (Sandbox Code Playgroud) 我在互联网上看如何保持从XML数据回车,但我找不到答案,所以我在这里:)
目标是在文件中写入XML数据的内容.因此,如果节点的值包含一些"\ r \n"数据,则软件需要在文件中写入它们以创建新行,但它不会写入,即使有空格:保留.
这是我的测试类:
XElement xRootNode = new XElement("DOCS");
XElement xData = null;
//XNamespace ns = XNamespace.Xml;
//XAttribute spacePreserve = new XAttribute(ns+"space", "preserve");
//xRootNode.Add(spacePreserve);
xData = new XElement("DOC");
xData.Add(new XAttribute("FILENAME", "c:\\titi\\prout.txt"));
xData.Add(new XAttribute("MODE", "APPEND"));
xData.Add("Hi my name is Baptiste\r\nI'm a lazy boy");
xRootNode.Add(xData);
bool result = Tools.writeToFile(xRootNode.ToString());
Run Code Online (Sandbox Code Playgroud)
这是我的流程类:
try
{
XElement xRootNode = XElement.Parse(xmlInputFiles);
String filename = xRootNode.Element(xNodeDoc).Attribute(xAttributeFilename).Value.ToString();
Boolean mode = false;
try
{
mode = xRootNode.Element(xNodeDoc).Attribute(xWriteMode).Value.ToString().ToUpper().Equals(xWriteModeAppend);
}
catch (Exception e)
{
mode = false;
}
String value = …Run Code Online (Sandbox Code Playgroud) 在这里关闭示例http://jqueryui.com/demos/autocomplete/#custom-data
我想知道如何ul在使用时向包装器添加样式_renderItem():
.data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
.appendTo( ul );
};
Run Code Online (Sandbox Code Playgroud) 我正在使用jQuery UI自动完成功能.我可以使用jQuery UI提供的示例,如下所示:
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$("#tags").autocomplete({
source: availableTags
});
Run Code Online (Sandbox Code Playgroud)
这没有任何问题.但我需要使用JSON作为我的数据源,可以像这样检索:http://mysite.local/services/suggest.ashx?query = ball
如果我要去那个URL,我会像这样得到JSON:
[{"id":12,"phrase":"Ball"},{"id":16,"phrase":"Football"},{"id":17,"phrase":"Softball"}]
Run Code Online (Sandbox Code Playgroud)
如何使用我的URL作为数据源?
我试过像这样更改source-option:
$("#tags").autocomplete({
source: "http://mysite.local/services/suggest.ashx"
});
Run Code Online (Sandbox Code Playgroud)
但它没有帮助.我猜这个服务不知道在输入字段中输入了哪个关键字?
任何指针都会很棒.
我一直在研究这个问题,似乎无处可去.基本上我在类的一堆输入上有自动完成,但是我需要获取特定的输入id来构建对象以发布ajax(我必须为这个项目使用POST而不是GET).
$(".input_autocomplete").autocomplete({
source: function( request, response ) {
// here is where I get the hash from local storage,
// reference the id and build the object
// tried this.id, $(this).prop('id'), no luck
$.ajax({
url: '/somepath/filename.htm',
contentType: 'application/json',
dataType: 'json',
type: 'POST',
data: JSON.stringify(obj),
success: function(json) {
return {
label: item.label,
value: item.label
}
},
error: function() {
// error handling
}
}); // ajax
} // source
});
Run Code Online (Sandbox Code Playgroud) 这是我的代码
@Html.DropDownListFor(z => z.SelectedReportId, new SelectList(Model.ReportTypes, "Value", "Text", Model.SelectedReportId), "-- Select Report --")
@Html.CheckBoxFor(model => model.IncludePhotos)@Html.LabelFor(model => model.IncludePhotos)
Run Code Online (Sandbox Code Playgroud)
哪个产生:
<select data-val="true" data-val-number="The field SelectedReportId must be a number." data-val-required="The SelectedReportId field is required." id="SelectedReportId" name="SelectedReportId">
<option value="">-- Select Report --</option>
<option value="1">Excel Report</option>
<option value="2">Text Report</option>
</select>
<br />
<input data-val="true" data-val-required="The Include photos in the report field is required." id="IncludePhotos" name="IncludePhotos" type="checkbox" value="true" />
Run Code Online (Sandbox Code Playgroud)
我有一个下拉列表和一个复选框,如果用户选择下拉列表中的第一个值,我需要禁用该复选框.这是我使用的javascript没有成功
$(function () {
$('#SelectedReportId').change(function () {
var value = $(this).val();
if (value == '1') …Run Code Online (Sandbox Code Playgroud) jquery ×7
jquery-ui ×3
c# ×2
asp.net-mvc ×1
autocomplete ×1
c#-4.0 ×1
css ×1
datatables ×1
forms ×1
fullcalendar ×1
javascript ×1
json ×1
linq ×1
linq-to-xml ×1
matlab ×1
plot ×1
plugins ×1
razor ×1
rotation ×1
smooth ×1
submit ×1
xml ×1