/    Sign up×
Community /Pin to ProfileBookmark

Hi,

I have a page where there is a form(and url is xyz.com/form)…

Now when the user submits the data, it should redirect to the home page of xyz.com(url is xyz.com) and then display a message as “Thank you” in an existing div id (div id=”message”)of the home page…

Is it possible to do it using javascript??

Will I get the value of that div id(message) when the it redirects to home page using javascript.

I could redirect the page to home page.. but couldnt insert contents in that div… or in a new div…

Please help

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERFeb 03.2011 — What have you tried?

Any test code available? working or not.
Copy linkTweet thisAlerts:
@ManasipradeepauthorFeb 03.2011 — Hi,

I believe that the value of a javascript will be lost when it goes to next page until and unless either a cookie is set or it is being passed as query string...

I am newbie in javascript... :-)

<html>

<head>

function redirect()

{

alert("This will be redirected");

cd=window.location.href="http://xyz.com";

document.getElementId('content').InnerHtml="THis text shud be inserted in this div" of xyz's homepage;

}

</head>

<body>

<label class="preField" for="tfa_Name">Name</label><input type="text" size="20"><br />

<label class="preField" for="tfa_Age">Age</label><input type="text" size="20"><br />

<label class="preField" for="tfa_Place">Place</label><input type="text" size="20"><br />

<input type="submit" Onclick="redirect();">

THis is the xzy.com home page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="description" content="">

<title>XYZ.COM</title>

<head>

<link href="" rel="stylesheet" type="text/css">


<link href="file:///C:/stylesheets/menu.css?1278745599" media="screen" rel="stylesheet" type="text/css">
</head>


<div id="container">

<div id="content"></div>

<div class="mainimagebox">

<div class="imgbox">








</div>
<div class="menu">

<div class="menubtn" id="menu">
<ul class="mainmenu" id="root"><li><a href="file:///C:/home" class="current_page_item">Home</a></li><li><a href="file:///C:/about-us" class="">About Us</a></li><li><a href="file:///C:/solutions" class="">Solutions</a></li><li><a href="file:///C:/superstars" class="">Superstars</a></li><li><a href="file:///C:/get-interactive" class="">Get Interactive</a></li></ul>
</div>

</div>

<div style="clear:both;"></div>

</div>


</body></html>
Copy linkTweet thisAlerts:
@JMRKERFeb 03.2011 — Hi,

I have a page where there is a form(and url is xyz.com/form)...

Now when the user submits the data, it should redirect to the home page of xyz.com(url is xyz.com) and then display a message as "Thank you" in an existing div id (div id="message")of the home page...

Is it possible to do it using javascript??

Will I get the value of that div id(message) when the it redirects to home page using javascript.

I could redirect the page to home page.. but couldnt insert contents in that div... or in a new div...

Please help[/QUOTE]


Sound like you are trying to do two things at the same time.

1. Submit the information

and

2. Redirect the page.

I believe the redirection will be done by the submission program on your server.

Depending on the program, this may or may not be possible. Check with your service.

For example, when I submit something to FormMail.cgi on my server, one of the options

of the server program is to issue a "Thank You" message.

Also, I don't think you can reference something on your local drive and expect someone

on the internet to have access to it. It would reference THEIR local drive and not find

any of the files you are trying to link to, unless they had exact copies on their machine.
×

Success!

Help @Manasipradeep spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...