Hector Barbossa
Hector Barbossa

Reputation: 5528

Javascript history.go

I need to give user one alert after saving an item.So I am using an open script to display this alert.But when I am moving out from that page and and coming back through history.go(-1) ,again getting the alert.How to make sure that this alert comes only if I am saving the item?

Upvotes: 0

Views: 792

Answers (1)

Guffa
Guffa

Reputation: 700562

If you use history,go(-1) then you are going to the page that saved the record, so it will be saving the record again.

It might work with history.go(-2) if you came from the page that shows the result, but it might not update with the saved record because the page is cached. Go on to the page that shows the result, instead of trying to find it in the history.

Upvotes: 1

Related Questions