Wordpress - Submit form into new tab and continue processing

社会主义新天地 提交于 2020-01-25 07:58:07

问题


I have a custome wordpress site I run, if a customer ticks a box on an angularjs based application form, I need to open a new tab by posting into an admin-post.php action but also continue processing the angularjs application in the original tab.

So the end result should be a new tab with a posted form and the existing tab with the results of the angularjs which is more ajax posts into the wordpress site.

What is happening is the form submit into a new tab is hanging behind the processing being done on ajax in the original tab. I'd prefer this to be flipped but also can't see why it's happening. Aren't 2 posts into the same wordpress, one admin-post and one ajax being treated separately?

It's difficult to provide examples as the site is sensitive but my angularjs runs something like

function processForm() {
    runSubmit();
    //Do the rest of the application submit via ajax and await response
}

function runSubmit() {
    form1.submit();
}

Basically the ajax code in the processForm() function is holding up the results of the runSubmit() form submit until it's complete.

I'm hoping a simple sleep somewhere will do the trick but not had any luck so far.

Thanks in advance.

来源:https://stackoverflow.com/questions/59862329/wordpress-submit-form-into-new-tab-and-continue-processing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!