Today, I'm going to tell you a little about how to go back to the page and refresh the data.
Problem: After the user submits the form to the data, return to the View list presentation layer.
There's wood, hurrying feet, it's easy to say, here the small partners may say that use a simple window.history.go (-1) method to return to, the last page, indeed, so, you can return directly to the previous page, but we carefully check the data, whether you found that the changes you made , not on the page can be displayed, only to refresh the page, you can change it.
here, the small knitting carefully inquires the window.history.go (-1) method Introduction:
Window.history.go (-1) is to return the previous page
Window.location.go (-1) is to refresh the previous page
All of them are locally saved session values, not dynamically obtained.
The final small series after a few filtered, finally got the answer:
Self.location = Document.referrer;
**document.referrer Overlay * * In terms of
usage document.referrer want to be able to trace the browser-side behavior. If a page A is opened, then the browser side of the action that may occur is user action, JS code two kinds.
! [Write a picture description here] (https://img-blog.csdn.net/20160728160207155)
$ (". Form-horizontal"). Ajaxform ({
type: "POST",
Data: $ (this). Serialize (),
dataType: "JSON",
Beforesend:function () {
},
success:function (data) {
//alert (data.status);
if (data.status = = 1) {
//window.location.go ( -1);
Self.location = Document.referrer;
$ (this). attr (' Data-url ', data.url);
$ ("#bl_id"). Val (data.id);
document.getElementById (' Extrabuton '). Click ();
else {
alert (data.info);
}
},
error:function (data) {
fillmessagetomodal ("<span class= ' Text-danger ' > Error </span> ', transform (Data.responsejson));
Messagemodal.modal (' show ');
Autoclosemessagemodal ();
}
);
Here, the small part of the form submitted, it will return to the previous page, and make a refresh,
Small partners, there is no understanding, do not know small partners, can be private small series Oh, welcome contributions.
Also welcome the big God, to the younger brother's code to put forward opinion, the younger brother will humbly be educated.