我能做一个"帖子"关于Ajax成功的行动

时间:2015-08-01 15:54:25

标签: jquery ajax jsp post hidden-field

我有以下代码:

$.ajax({
    type: "post",
    url: "./api/v1/bluemix/auth",
    data: datas,
    success: function(data){

            var successUrl = "CreateBluemixMonkey.jsp"; 
            window.location.href = successUrl + "?data=" + newdata ;

                },
                error: function(jqXHR,error, errorThrown) {
                 alert("Error");

                }
}) 

成功进行AJAX通话后,我正在设置window.location.href。相反,我可以在同一个JSP上做另一个帖子吗?我试图使用隐藏的值,但我怀疑,因为没有post方法。我在CreateBluemixMonkey.jsp中将所有隐藏的字段值都设为null

1 个答案:

答案 0 :(得分:1)

您可以在页面上创建一些隐藏的输入,然后调用submit-method。这样就生成了一个POST-Request而不是一个GET-Request,它是从window.location.href代码行生成的。

如果可能,只需在页面上创建隐藏的静态,最好将ERROR [org.springframework.extensions.surf.util.AbstractLifecycleBean] [org.subethamail.smtp.server.Session-/2001:470:c27d:18:0:0:0:17:62204] 06300186 Email message processing failed org.alfresco.error.AlfrescoRuntimeException: 06300186 Email message processing failed at org.alfresco.email.server.EmailServiceImpl.processMessage(EmailServiceImpl.java:324) at org.alfresco.email.server.EmailServiceImpl.importMessage(EmailServiceImpl.java:180) at org.alfresco.email.server.impl.subetha.SubethaEmailServer$Handler.processDelivery(SubethaEmailServer.java:223) at org.alfresco.email.server.impl.subetha.SubethaEmailServer$Handler.data(SubethaEmailServer.java:184) at org.subethamail.smtp.command.DataCommand.execute(DataCommand.java:61) at org.subethamail.smtp.server.RequireTLSCommandWrapper.execute(RequireTLSCommandWrapper.java:27) at org.subethamail.smtp.server.CommandHandler.handleCommand(CommandHandler.java:98) at org.subethamail.smtp.server.Session.runCommandLoop(Session.java:222) at org.subethamail.smtp.server.Session.run(Session.java:125) Caused by: org.alfresco.error.AlfrescoRuntimeException: 06300185 Not all patches could be applied at org.alfresco.repo.admin.patch.PatchExecuter.applyOutstandingPatches(PatchExecuter.java:111) at org.alfresco.repo.admin.patch.PatchExecuter$1.doWork(PatchExecuter.java:124) at org.alfresco.repo.admin.patch.PatchExecuter$1.doWork(PatchExecuter.java:120) at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548) at org.alfresco.repo.admin.patch.PatchExecuter.onBootstrap(PatchExecuter.java:128) at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56) at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:209) at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:180) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at com.sscorp.CustomFolderEmailMessageHandler.addAlfrescoContent(CustomFolderEmailMessageHandler.java:132) at com.sscorp.CustomFolderEmailMessageHandler.processMessage(CustomFolderEmailMessageHandler.java:94) at org.alfresco.email.server.EmailServiceImpl$3.execute(EmailServiceImpl.java:296) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:454) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:342) at org.alfresco.email.server.EmailServiceImpl$4.doWork(EmailServiceImpl.java:304) at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548) at org.alfresco.email.server.EmailServiceImpl.processMessage(EmailServiceImpl.java:307) ... 8 more 设置为CSS样式。然后给form-tag一个ID并在你的success-function中运行'display: none;'