[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
hi /g/
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

You are currently reading a thread in /g/ - Technology

Thread replies: 16
Thread images: 3
File: gmail.png (3 KB, 204x204) Image search: [iqdb] [SauceNao] [Google]
gmail.png
3 KB, 204x204
hi /g/
how do I store form data as a javascript variable? for example how would I store the user's email adress as
var email = [email protected]

<form action="thankyou.html" method="post" id="emailcap">
E-mail: <input type="text" name="email">
<input type="submit" value="send"></form>


thanks
>>
quick note: I can't use php on that exact page therefore it must be javascript
>>
>>52387595
https://api.jquery.com/serialize/
>>
>>52387595
var email = $("[name=email]").val();

I'm assuming you're using jQuery.
>>
File: video.jpg (29 KB, 340x233) Image search: [iqdb] [SauceNao] [Google]
video.jpg
29 KB, 340x233
This script for some reason takes me to www.name.com/?name=INPUT&email=INPUT2
instead of my hyperphp url, I don't think it's a redirect from hyper php since if I enter the code with the data manually it works correctly

what do?


<html><head>
<script type="text/javascript">
function goToPage() {
var name = document.getElementById('name').value;
var email = document.getElementById('email').value;
var thepage = "MYTOPSECRETURL?name=" + name + "&email="+ email;
window.location = thepage;
}
</script>
</head><body>
name<input type="text" id="name" />
email <input type="text" id="email" />
<input type="submit" value="submit" onclick="goToPage();" />
</script>
</body>

</html>
>>
>>52388697
Works fine here. Change the URL for a random third party one to verify it's not your script.

<html><head>
<script type="text/javascript">
function goToPage() {
var name = document.getElementById('name').value;
var email = document.getElementById('email').value;
var thepage = "http://bbc.co.uk?name=" + name + "&email="+ email;
window.location = thepage;
}
</script>
</head><body>
name<input type="text" id="name" />
email <input type="text" id="email" />
<input type="submit" value="submit" onclick="goToPage();" />
</script>
</body>

</html>
>>
>>52388944
I tried it with facebook.com?blahblah
still took me to name.com/?blahblah instead
>>
infact, here:

http://fastimpression.hyperphp.com/form.html
>>
>>52389024
>>52389053
You forgot the
http://
in `thepage`.

Without it, your browser will try to load a relative URL.
>>
>>52389053
>>52388944
update: it only redirects to www.name.com on mozilla, it is fine on internet explorer?
>>
>>52389170
just fixed that myself, silly error when I was hiding my url
try it now.
>>
>>52389170
please let me know what browser you use
>>
>>52389201
Seems to work, I get "Thankyou".
>>
>>52389242
that means it works, here's what it sends me to on firefox:
https://www.name.com/?name=testname&[email protected]&utm_expid=3399857-40.ep5u_QPVQ3KtPVAJKFYWJA.0&utm_referrer=http%3A%2F%2Ffastimpression.hyperphp.com%2Fform.html

I'm checking everywhere for malware or shitty addons that I may have accidentally downloaded but I don't see anything that might cause it, even reinstalled firefox
>>
>>52389232
>>52389302
Tried on Chrome, Safari, and Firefox. Can't reproduce. Whatever you've got going on there, it's on your end.
>>
>>52389407
thanks for testing it bro, at least I know it's my end
it seems to do it when I'm logged out too
Thread replies: 16
Thread images: 3
Thread DB ID: 423991



[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at [email protected] with the post's information.