14, February 2012

How do I pass data between JavaScript pages? - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  JavaScript
Topic: How do I pass data between JavaScript pages?
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: How do I pass data between JavaScript pages?  (Read 6018 times)
My name is Bong, James Bong
*
Gender: Female
Posts: 10
118 credits
Members referred : 0



« on: Aug 12, 2008, 03:08:12 pm »

Please anybody tell me that how can i pass the data between javascript pages?
Just another rainy day
*
Posts: 1
16 credits
Members referred : 0


« Reply #1 on: Sep 15, 2008, 02:28:39 pm »

use HTML editor and past into your BODY tag...


<spam />
« Last Edit: Sep 16, 2008, 10:05:18 am by Olaf »
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Sep 16, 2008, 10:06:37 am »

Please anybody tell me that how can i pass the data between javascript pages?

I'm not so good in client site code, but you could write a cookie or use the querystring


Last blog : A new Wordpress theme for our blog
I crack Photoshop!
*
Posts: 3
24 credits
Members referred : 0


« Reply #3 on: Oct 03, 2008, 01:42:26 pm »

you can pass it using urls code like by placing the questions marks at the end of the urls..
« Last Edit: Oct 06, 2008, 05:38:29 pm by Nikolas »
My name is Bong, James Bong
*
Posts: 11
80 credits
Members referred : 0



« Reply #4 on: Apr 18, 2009, 01:26:11 pm »

Quote from: alisha0512
Please anybody tell me that how can i pass the data between javascript pages?

Could you be more specific. What are you trying to achieve ?! Do you want one js variable to be available in some other web page ?
OMG!I am geek
**
Posts: 56
372 credits
Members referred : 0


« Reply #5 on: Apr 05, 2011, 02:11:00 pm »

JavaScript page has retrieved some information from the user. Now you want to display another JavaScript page, which should also use that information. How do you pass it from the first page to the second? There are three simple solutions. The first two are safe and effective, with advantages and disadvantages to each.
Bill Gates is my home boy
*****
Posts: 651
4740 credits
Members referred : 0


« Reply #6 on: Jun 08, 2011, 07:36:35 pm »

You could pass the data using body tags. If the case is passing data between JS page to another JS page.

Affiliate Programs
CPA Network
Affiliate Network

I wish I was an Oscar winner
**
Posts: 90
580 credits
Members referred : 0


« Reply #7 on: Jun 12, 2011, 07:07:35 am »

Im also new to Java can any one help
Just another rainy day
*
Posts: 1
6 credits
Members referred : 0


« Reply #8 on: Jun 28, 2011, 10:25:23 am »

i am also new to that..
Sandwich Artist
*
Posts: 25
174 credits
Members referred : 0


« Reply #9 on: Aug 18, 2011, 11:21:05 am »

passdata1a.html

<script>
var data = new Array();
data[0] = "one, a datum";
data[1] = "two, a deer";
data[2] = "three, a slash: \\";
data[3] = "four has quotes: \"I forget what four was for\"";
</script>
<form name="data" method="POST" action="passdata1b.php">
<input type="hidden" name="data">
</form>
<script>
function sendData()
{
  // Initialize packed or we get the word 'undefined'
  var packed = "";
  for (i = 0; (i < data.length); i++) {
    if (i > 0) {
      packed += ",";
    }
    packed += escape(data[i]);
  }
  document.data.data.value = packed;
  document.data.submit();
}
</script>
<h1>This is what the array contains:</h1>
<ul>
<script>
  for (i = 0; (i < data.length); i++) {
    document.write("<li>" + data[i] + "</li>\n");
  }
</script>
</ul>
<a href="javascript:sendData();">Go to passdata1b.php</a>

passdata1b.php

<?php
  $packed = $_POST['data'];
  $data = split(",", $packed);
  for ($i = 0; ($i < count($data)); $i++) {
    # Undo what JavaScript's escape() function did
    $data[$i] = rawurldecode($data[$i]);
    # Slashes need escaping when they appear in code
    $data[$i] = str_replace("\\", "\\\\", $data[$i]);
    # Quotes need escaping too
    $data[$i] = str_replace("\"", "\\\"", $data[$i]);
  }
?>
<script>
  var data = new Array (
<?php
  for ($i = 0; ($i < count($data)); $i++) {
    if ($i > 0) {
      echo ",\n";
    }
    echo "    \"";
    echo $data[$i];
    echo "\"";
  }
?>

  );
</script>
<h1>This is what the data contains:</h1>
<ul>
<script>
  for (i = 0; (i < data.length); i++) {
    document.write("<li>" + data[i] + "</li>\n");
  }
</script>
</ul>
Cyberpunk Wannabe
*
Posts: 44
300 credits
Members referred : 0


« Reply #10 on: Aug 18, 2011, 11:33:18 am »

Sounds like this would be far more easily done using CGI (make the form action a cgi script. This will pick up the details passed and generate a dynamic page containing them)
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7901
Tags : javascript Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  JavaScript
Topic: How do I pass data between JavaScript pages?
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Feb 14, 2012, 03:16:06 am





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.