简体   繁体   English

如何在不刷新jquery AJAX中的页面的情况下返回按钮单击?

[英]How to go back on a button click without refreshing page in 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. 如何在不刷新页面的情况下返回。首先,我是从AJAX动态获取数据的,但是当我单击“后退”按钮时,它将带我到它实际开始的主要位置。

So here's the scenario: 所以这是场景:

3 Locations 3个地点

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... 当我按下它时,在deposit.php中有一个名为Deposit的按钮。它带我到了更多按钮的位置,例如使用信用卡付款,使用借记卡付款等,而当我单击使用信用卡付款时,它将带我到位置pay.php ..到目前为止,一切都很好...

Here's the problem occurs 这是发生问题的地方

whenever I press back, it takes me back to deposit.php instead of pay.php 每当我按回去时,它将带我回到deposit.php而不是pay.php

deposit.php deposit.php

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

pay.php 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 有2个定位标记。一个不带有href属性,另一个不带有href ='#'属性

Talking about without href attribute, when I press the back button it takes me to the deposit.php(completey back, where it all started) 谈论没有href属性的情况,当我按下返回按钮时,它将带我到deposit.php(完全返回,这一切都从这里开始)

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)... 关于href属性,当我按下“用信用卡付款”按钮时,URL更改为/pay.php#。当我第一次按下“后退”按钮时,它不会返回。如果我按下两次,它将转到完全回来了(deposit.php)...

paying.php should I put back button in here.but can't figure out the scenario of back button paying.php我应该把返回按钮here.but想不通后退按钮的情况下

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 每当我在Chrome中按“后退”按钮时,我应该怎么做,它应该带我回到pay.php而不是deposit.php

ps: I am using ajax jquery and page is not refreshing anywhere.it ps:我正在使用ajax jquery,页面在任何地方都没有刷新。

将此添加到您的输入或锚元素中:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM