将数组列表值从一个 JavaScript 传递到另一个 JavaScript
我有一个值的数组列表,必须从一个 html (javascript) 传递到另一个。
我的代码是:
function show_confirm()
{
//var r=confirm("Do you wish to use the existing Details?");
apprise('Do you wish to use the existing details?', {'verify':true}, function(r)
{
if(r)
{
// user clicked 'Yes'
alert("yes");
var a=camera.getDetails();
//window.locaton="http://www.google.co.in/";
var s=a.get(0);
alert(s);
//alert("rettttttttt" + a);
window.location="my_details.html?" + s;
//document.getElementById("location").value=a.get(0) + " ";
//alert(a.get(0) + " ");
//fetch my details from native
}
else
{
// user clicked 'No'
// display new form
alert("no");
}
});
}
</script>
在 my_details.html 中:
function submitForm(){
//var policyNumber=document.getElementById("number").value;
//var a=camera.getDetails();
var q=window.location.search;
if (q.substring(0, 1) == '?') {
q = query.substring(1);
}
alert("qqqqqqqqqq "+ q);
</script>
如何在脚本之间传递数据?
我通过以下方式解决了这个问题:
var c=new Array(a); (eg: a={"1","2"})
window.location="my_details.html?"+ c + "_";
在 my_details.html 中:
var q=window.location.search;
alert("qqqqqqqqqqqqq " + q);
var arrayList = (q)? q.substring(1).split("_"):[];
var list=new Array(arrayList);
alert("dataaaaaaaaaaaa " + list + "llll " );
在“list”中,它显示了我“1%202”;
我怎样才能删除这个 %20 =space 值?
谢谢
斯内哈
I have an arraylist of values which must be passed from one html (javascript) to another.
My code is :
function show_confirm()
{
//var r=confirm("Do you wish to use the existing Details?");
apprise('Do you wish to use the existing details?', {'verify':true}, function(r)
{
if(r)
{
// user clicked 'Yes'
alert("yes");
var a=camera.getDetails();
//window.locaton="http://www.google.co.in/";
var s=a.get(0);
alert(s);
//alert("rettttttttt" + a);
window.location="my_details.html?" + s;
//document.getElementById("location").value=a.get(0) + " ";
//alert(a.get(0) + " ");
//fetch my details from native
}
else
{
// user clicked 'No'
// display new form
alert("no");
}
});
}
</script>
and in my_details.html :
function submitForm(){
//var policyNumber=document.getElementById("number").value;
//var a=camera.getDetails();
var q=window.location.search;
if (q.substring(0, 1) == '?') {
q = query.substring(1);
}
alert("qqqqqqqqqq "+ q);
</script>
How to pass data between scripts?
I resolved it in the following way:
var c=new Array(a); (eg: a={"1","2"})
window.location="my_details.html?"+ c + "_";
and in my_details.html :
var q=window.location.search;
alert("qqqqqqqqqqqqq " + q);
var arrayList = (q)? q.substring(1).split("_"):[];
var list=new Array(arrayList);
alert("dataaaaaaaaaaaa " + list + "llll " );
and in "list" its dusplaying me "1%202";
How can i remove this %20 =space value ??
thanks
Sneha
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你是说这个吗?
You mean this?