使用AJAX在2个HTML页面之间传递数据 [英] Passing Data Between 2 HTML Pages Using AJAX

查看:848
本文介绍了使用AJAX在2个HTML页面之间传递数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个HTML页面,在第1个HTML页面中有一个包含2个文本框和表格的表单。提交按钮。我想用一些日期填写表格。想要将这些值传递给第二页。在第2页中,这些值存储在2个不同的变量中。这些变量旨在传递给URL。此URL位于下方。



I have 2 HTML pages and in the 1st HTML page there is a form with 2 textboxes & a submit button. I want to fill the form with some date & want to pass those values to the 2nd page. In the 2nd page those values to be stored in 2 different variables. These variables are intended to pass to the URL. This URL is at the below.

<script type="text/javascript" >
	var googleURL ='https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A76546294&dimensions=' + 'ga%3Asource&metrics=ga%3Ausers&sort=-ga%3Ausers&start-date='"+strStartDate+"'&end-date='"+strEndDate+"'&max-results=10';





这些变量值应该作为strStartDate& strEndDate为动态值。



我期待使用AJAX& HTML 5.



谢谢,

Chiranthaka



These variable values should place as the strStartDate & strEndDate as dynamic values.

I am expecting an answer using AJAX & HTML 5.

Thanks,
Chiranthaka

推荐答案

你需要3页。



一个父页面,数据将存储在页面之间。

第一个HTML页面有一个包含2个文本框的表单提交按钮

第2页 - 创建URL页面



从父页面打开第1页HTML页面。

单击提交时,将值保存到父级。

window.opener.hdnValueOne.value = document.getElementById('txtValueOne')。value;



来自父打开页面2和关闭第一页。

使用window.opener.hdnValueOne.value从父表单中提取值。
You will need 3 pages.

A parent page where the data will be stored between pages.
1st HTML page there is a form with 2 textboxes & a submit button
2nd page - Create URL page

From the parent page open 1st HTML page.
When submit is clicked save the values to the parent.
window.opener.hdnValueOne.value = document.getElementById('txtValueOne').value;

From the parent open page 2 and close page one.
Use window.opener.hdnValueOne.value to pull the value from the parent form.


这篇关于使用AJAX在2个HTML页面之间传递数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆