Forum Discussion
XavierFan
11 years agoQrew Cadet
Try this - see the bolded text to replace the line with "location.reload(true)"
var text NewStatus= If([Backorder Status]="Filled", "On Backorder", "Filled");
var text URL = URLRoot() & "db/" & [_DBID_BACKORDER_LINES] & "?act=API_EditRecord"
& "&rid=" & ToText([Record ID#])
& "&_fid_6=" & $NewStatus;
"javascript:" &
"$.get('" &
$URL &
"',function(){" &
"location.href = location.href + '&d=' + Date.now() + '#DealerClaim';" &
"});"
& "void(0);"
This constructs a new URL to go to. location.href is the current URL, and that's normally where the browser goes when you do location.reload(true).
If you just put #DealerClaim at the end, the problem is that the browser doesn't refresh, and just jumps down to the anchor (which is normal browser behavior for anchors when you're on the same page already).
So what we do is change the URL dynamically by putting in '&d=' + Date.now() - which puts a timestamp on the URL. e.g. &d=1426960116976
Since the URL is now different every time you press the button, the browser reloads the page, and then jumps to the anchor position.
var text NewStatus= If([Backorder Status]="Filled", "On Backorder", "Filled");
var text URL = URLRoot() & "db/" & [_DBID_BACKORDER_LINES] & "?act=API_EditRecord"
& "&rid=" & ToText([Record ID#])
& "&_fid_6=" & $NewStatus;
"javascript:" &
"$.get('" &
$URL &
"',function(){" &
"location.href = location.href + '&d=' + Date.now() + '#DealerClaim';" &
"});"
& "void(0);"
This constructs a new URL to go to. location.href is the current URL, and that's normally where the browser goes when you do location.reload(true).
If you just put #DealerClaim at the end, the problem is that the browser doesn't refresh, and just jumps down to the anchor (which is normal browser behavior for anchors when you're on the same page already).
So what we do is change the URL dynamically by putting in '&d=' + Date.now() - which puts a timestamp on the URL. e.g. &d=1426960116976
Since the URL is now different every time you press the button, the browser reloads the page, and then jumps to the anchor position.