dtbrd80422 2019-07-14 11:39
浏览 96

如何在没有刷新jquery AJAX页面的情况下返回按钮点击?

How to go back without page refreshing.Firstly, I am getting data from AJAX dynamically.but when I click Back button it takes me to the main location where it actually started.

So here's the scenario:

3 Locations

There is a button named Deposit in deposit.php when I press it.It took me to location where there are more buttons,like pay with credit card, pay with debit card etc and when I click on pay with credit card, it takes me to the location pay.php..So far everything's fine...

Here's the problem occurs

whenever I press back, it takes me back to deposit.php instead of pay.php

deposit.php

 <input type="submit" class='btn btn-primary btn-large' name="send" id="send" value="Deposit" /><br/>

pay.php

 <a id='credit'>Pay with credit card</a>
 <a id='debit' href='#'>Pay with credit card</a>

Here one thing to notice:

There are 2 anchor tag.one is without href attribute and one is with href='#'attribute

Talking about without href attribute, when I press the back button it takes me to the deposit.php(completey back, where it all started)

Talking about with href attribute, when I press the pay with credit card button.url changes to /pay.php#.When I first press the back button, it doesn't go back..if I press it twice, it goes to completely back(deposit.php)...

paying.php should I put back button in here.but can't figure out the scenario of back button

So My question is:

what should I do that whenever I press back button in chrome, it should take me back to pay.php instead of deposit.php

ps: I am using ajax jquery and page is not refreshing anywhere.it

  • 写回答

1条回答 默认 最新

  • dongxian8048 2019-07-14 12:13
    关注

    Add this in your input or anchor element:

    <button value="Back" type="Button" onclick="history.go(-1);">Go back</button>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)