如何在重定向到自己之前更改HTML页面。 [英] How to change HTML page before I redirect myself to it.
问题描述
我有一个html页面,我有第二个html页面。我想将自己从第一页重定向到第二页,但在重定向到第二页之前,我需要在第2页的html中显示一些内容。任何人都可以告诉我该怎么做?
在第一页我有一些表格,当表格被压缩并且按下按钮时我不会.ajax调用并且在成功功能中我想要做一些更改之前我将自己重定向到第二个HTML。问题是我将自己重定向到第二页但没有任何改变....我要展示的元素没有显示......
我尝试了什么:
I have one html page and i have second html page . i want to redirect myself from page one to page two but before i am redirected to page two i need to show somthing in html of page 2 . Can anyone tell me how to do that ?
In first page i have some form and when form is complited and presed button i am dont .ajax call and in the success function i want to do some changes before i redirect myself to second html. Problem is that i redirect myself to the second page but nothing is changed.... my element which i want to show is not showing ...
What I have tried:
$(document).ready(function(){
$('#logovanje').submit(function(event){
event.preventDefault();
let korisnickoIme = $('#korisnickoIme').val();
let lozinka = $('#lozinka').val();
$.post({
url: '../rest/logovanje',
data: JSON.stringify({korisnickoIme: korisnickoIme, lozinka: lozinka}),
contentType: 'application/json',
success: function(data) {
alert("Uspesno ulogovan korisnik")
$("#korisnik").hide();
$("#korisnik1").show();
window.location.replace( '../Pocetna.html' );
},
error: function(message) {
alert("Neuspesno ulogovan korisnik")
}
});
});
});
这里:
here:
$("#korisnik").hide();
$("#korisnik1").show();
korisnik和korisnik1是div元素的第二页,我试图显示它并隐藏th div元素...请问有谁能告诉我我在哪里做错了我不知道是什么做...
korisnik and korisnik1 is id form second page of div element and i try to show it and hide thos div element... pls can anyone tell me where i am doing wrong here i do not know what to do...
推荐答案
( document )。ready( function (){
(document).ready(function(){
(' #logovanje' )。submit( function (event){
event.preventDefault();
让 korisnickoIme =
('#logovanje').submit(function(event){ event.preventDefault(); let korisnickoIme =
(' #korisnickoIme')。val();
让 lozinka =
('#korisnickoIme').val(); let lozinka =
这篇关于如何在重定向到自己之前更改HTML页面。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!