$(document).ready(function() {
var options = {
target: '#output1', // target element(s) to be updated with server response
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback
};
$('#myForm1').ajaxForm(options);
});
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
alert('About to submit: \n\n' + queryString);
return true;
}
function showResponse(responseText, statusText) {
alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
'\n\nThe output div should have already been updated with the responseText.');
}
Run Code Online (Sandbox Code Playgroud)
在上面的程序中,选项参数传递了什么?我使用http://jquery.malsup.com/
我收到一个Android错误,即使错误消息非常明显,我也无法弄清楚如何使其正常工作。
错误消息是:
java.lang.IllegalStateException: Must be called from main thread
at android.app.Activity.recreate(Activity.java:4193)
Run Code Online (Sandbox Code Playgroud)
在我的应用程序中,发送了一条通知以注销用户(当他的令牌过期时)。
在较旧的Android版本上,我这样做没有问题,但是从SDK 11起,我必须使用recreate()方法。我收到必须从主线程调用它的错误。
我将recreate()语句移至MainActivity类,当我从IntentService调用该方法时,此方法不起作用。我仍然遇到相同的错误。消息传递部分工作正常,只是注销消息的处理导致此错误。
以下是一些摘要:
在GcmIntentService.java中
if (logout!=null) {
VarControl.ma.logout();
}
Run Code Online (Sandbox Code Playgroud)
在MainActivity.java中
public void logout() {
deleteToken();
closeWebView();
restartApp();
}
public void restartApp() {
if (Build.VERSION.SDK_INT >= 11) {
this.recreate(); // THE ERROR OCCURS HERE
}
else{
//left out this part because its not relevant
}
}
Run Code Online (Sandbox Code Playgroud)
我如何从主线程调用recreate(但是必须在接收到意图后处理代码)?
我为我的Calendar实例做了这个,以UTC时区返回日期:
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:SS Z");
TimeZone tz = TimeZoneUtil.getTimeZone(StringPool.UTC);
formatter.setTimeZone(tz);
Date dtStart = null;
Date dtEnd = null;
try{
dtStart = formatter.parse(formatter.format(startDate.getTime()));
dtEnd = formatter.parse(formatter.format(endDate.getTime()));
}catch (Exception e) {
e.getStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
它工作正常,直到我格式化日历时间戳以返回具有所需时区的字符串日期,但是当我将该字符串日期解析为日期日期时,它再次选择本地时区?我需要以UTC时区存储Date对象.
任何帮助将非常感谢!
我的用户表单中有选择框的表单.我还需要在编辑模式下更新表单.我能够在编辑模式下获得选定的值.但我无法在编辑模式下设置所选值.
在这里,我可以从db中获取所选值.<%=user.getTitle() %>
现在我如何在选择框中设置所选值.
<aui:select name="title">
<aui:option label="Dr" value="dr" />
<aui:option label="Mr" value="mr" />
<aui:option label="Mrs" value="mrs" />
<aui:option label="Ms" value="ms" />
</aui:select>
Run Code Online (Sandbox Code Playgroud)
示例I为此输入字段设置所选值,
<aui:input name="emailAddress" value=""></aui:input>
Run Code Online (Sandbox Code Playgroud)
有什么建议请!!
您好我正在使用PrimeFaces p:calendar
组件,我的问题是如何将星期一设置为一周的第一天,而不是星期日(默认)?
标签代码p:calendar
:
<p:calendar id="toDate" label="#{msg.date_to_report}"
value="#{dailyCashierReport.toDate}" showOn="button" pattern="dd-MM-yyyy" />
Run Code Online (Sandbox Code Playgroud)
有没有办法在JSP + java中使用jQuery上传multipart文件.在jQuery AJAX中执行时出错.
$.ajax({
type: "POST",
url: "${pageContext.request.contextPath}/users/imageUpload/" + $imageUpload + "/" + $userId??,
contentType: "multipart/form-data",
processData: false,
}).done(function(data) {}).fail(function(data) {
alert("Ooopss..! Something Bad Happened.!");
});
Run Code Online (Sandbox Code Playgroud)