dty47696 2012-10-11 15:44
浏览 174
已采纳

在表单提交和重定向之间显示“请等待”

I have a page that contains an HTML form that submits back to itself once the user clicks a link in a list of returned search results. Once they click the link, the page takes the submitted variables, runs a bunch of searches on various external APIs, parses a bunch of data, and adds a bunch of stuff to the database, then redirects to a new page that has been created from that data.

All the searching and parsing can take up to six or seven seconds; I'd like to be able to show the user a "Please Wait" kind of message while all that work is happening behind the scenes.

Trouble is, I can't show and hide a DIV because it will screw up my PHP redirect if I've already generated output before the

header('Location: ' . $newURL);

command. I've searched around for answers but while there are many that are similar, none of them are close enough to my specific situation that I can hack around them.

I'd be grateful if someone could point me in the right direction.


Updated version which now works, courtesy @Izkata from his comments below:

jQuery("a").bind('click', function() {
  jQuery('#feedback')[0].innerHTML = 'Searching, please wait...';
})

Turned out what I needed to do was assign bind a the message to the click of a link, not to 'submit', as submit was looking for form data.

  • 写回答

3条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥100 IIC通讯数据算法分析
      • ¥15 matlab 绘制涡流场
      • ¥15 依存句法分析如何与BERT模型及GCN相结合
      • ¥66 有偿收一个会Python 与unitysocket通信,会简单mediapipe手势识别的哥
      • ¥15 药店卖药设计使利润最大
      • ¥15 模拟银行实现VIP服务
      • ¥20 ECU在实车上can通讯失败或不稳定
      • ¥15 关于VB.net调用Excel如何打包的问题?
      • ¥15 VB6.0+WebBrowser如何实现网页内嵌图片按钮点击
      • ¥30 请问纯C语言如何编写简易的easyx图形库