Add Paypal to simple website - javascript

<!DOCTYPE html>
<html>
<head>
<title>Our Company</title>
<link href="site.css" rel="stylesheet">
</head>
<body>
<div id="main">
<h1>E-commerce Website</h1>
<h2>Website Pages:</h2>
<p>Home Page</p>
<p>About Us</p>
<p>Our Products</p>
<p>Buy Now</p>
<footer id="foot01"></footer>
</div>
<script src="script.js"></script>
</body>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="Email">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
</html>
It is a very simple HTML page, I am trying to add a code I've got from a paypal website on how to add a paypal button and (They said it should work when I add it to my Page) It is not working though...The form tag is flagging red error ??
Thanks for any Help in advance!

All the HTML content to be displayed needs to be between the
<body>
and
</body>
tags. Just move the Paypal content above the closing </body>.

Related

prev() not working in my code

I have a button and on the click of it, I want to have the value of product_id which is its sibling but following code isn't working. It is giving me undefined. Fiddle Html is mostly fixed i can't give any classes
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>prev demo</title>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<form class="commerce-add-to-cart commerce-cart-add-to-cart-form-3" action="/drupal_commerce/" method="post" id="commerce-cart-add-to-cart-form-3" accept-charset="UTF-8">
<div>
<input type="hidden" name="product_id" value="3">
<input type="hidden" name="form_build_id" value="form-WLgRLYXPHDHNkH-vTSrERT4DGaqutn88pAlta_eJNig">
<input type="hidden" name="form_token" value="UhnJe2M-N6lxx2LdqBvWm6EUbB7gD0Uv3r3OaTc_s1Q">
<input type="hidden" name="form_id" value="commerce_cart_add_to_cart_form_3">
<div id="edit-line-item-fields--2" class="form-wrapper"></div>
<input type="hidden" name="quantity" value="1">
<input class="button01 form-submit" type="submit" id="edit-submit--3" name="op" value="Add to cart">
</div>
</form>
<script>
$('.commerce-add-to-cart input[type="submit"]').on('click', function(event){
console.log($(this).prev('input[name=product_id]').val())
});
</script>
</body>
</html>

How to link html login page to another

I have created simple login page using html. i want create link with another page after click login page.here attach my code i set its not working .how to link another page after login ..here My code
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Login Form</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<IMG class="displayed" src="images/wel..png" alt="...">
<div id="login">
<div id="triangle"></div>
<h1>Log in</h1>
<form>
<input type="Username" placeholder="Username" />
<input type="password" placeholder="Password" />
<input type="submit" value="Log in" />
</form>
</div>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>
Are you looking for action attribute of form?
Try this:
<form action="http://www.example.com" method="post">
<input type="Username" placeholder="Username" />
<input type="password" placeholder="Password" />
<input type="submit" value="Log in" />
</form>
you have to change
<form action="youpagename">
Try to following:
<form method="GET" action="foo.html">
<input type="submit" value="Login"/>
</form>
This is the same, but valid, and is equivalent to:
<a href="foo.html">

Javascript: Autosubmitting form post data and not redirecting or refreshing the page

I need to be able to auto-submit form post data and not have the page redirect like in my current code. Everything I come across on the subject involves jquery and ajax. I just can't get a working version using any of their examples.
Here is my current working page that redirects:
<!DOCTYPE html>
<html>
<head>
<title>Does it work?</title>
</head>`
<body>
<form name="actionBalance" method="post" action="action.php">
<input type="hidden" name="name" value="value2">
<input type="hidden" name="name2" value="value2">
<input type="hidden" name="name3" value="value3">
</form>
</body>
<script>document.actionBalance.submit()</script>
</html>
You need to call jquery post method with your form data like this.
$(document).ready(function() {
$.post( "action.php", $('form[name=actionBalance]').serialize() );
});
$(document).ready(function() {
$.post("action.php", {name: "value", name2: "value2", name3: "value3"});
});
Try this one, it should be working:
<!DOCTYPE html>
<html>
<head>
<title>Does it work?</title>
</head>
<body onload="document.createElement('form').submit.call(document.getElementById('actionBalance'))">
<form id="actionBalance" name="actionBalance" method="POST" action="action.php">
<input type="hidden" name="name1" id="name1" value="value1" />
<input type="hidden" name="name2" id="name2" value="value2" />
<input type="hidden" name="name3" id="name3" value="value3" />
<input type=hidden name="submit" id="submit" value="Continue"/>
</form>
</body>
</html>
Another option is put an iframe, so when page loads, then iframe load your payload (your form with the javascript that you put in your question) and the form will be submit.
I think you are looking for this solution with redirect right after submit:
<!DOCTYPE html>
<html>
<head>
<title>Does it work?</title>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script>
$(document).ready(function(){
$('form').submit();
});
</script>
</head>
<body>
<form name="actionBalance" method="post" action="action.php">
<input type="hidden" name="name" value="value2">
<input type="hidden" name="name2" value="value2">
<input type="hidden" name="name3" value="value3">
</form>
</body>
</html>
Try to replace your whole script with this and let me know if this is what you wanted :-)
EDIT: If you need only that piece of script then jquery could be an overkill because it is huge library. So here is pure javascript for you :
<!DOCTYPE html>
<html>
<head>
<title>Does it work?</title>
</head>
<body>
<form name="actionBalance" method="post" action="action.php">
<input type="hidden" name="name" value="value2">
<input type="hidden" name="name2" value="value2">
<input type="hidden" name="name3" value="value3">
</form>
<script type="text/javascript">
var form = document.getElementsByName('actionBalance')[0];
form.submit();
</script>
</body>
</html>

Checkbox validation within wordpress for a paypal button

I am trying to get a simple Terms and Conditions checkbox to validate before a user is allowed to click a paypal button. I currently have this code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="my email">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="15-minutes">
<input type="hidden" name="amount" value="15.00">
<input type="hidden" name="currency_code" value="USD">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif"alt="stuff">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
Any help or guidance would be super helpful.
Festivus for the rest of us,
Tom
A little jQuery like this should do the trick: http://jsfiddle.net/mVK4r/
I added a terms and conditions checkbox and then tested to see if it's checked. If it is, the button behaves normally. If it is not, there's an alert prompting the user to accept the terms and the button won't work.
Hope this helps - good luck!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Terms and Conditions check box -->
<p><input type="checkbox" id="terms"> Yes, I accept the terms and conditions</p>
<p> </p>
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="my email">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="15-minutes">
<input type="hidden" name="amount" value="15.00">
<input type="hidden" name="currency_code" value="USD">
<!-- Display the payment button. -->
<input type="image" id="button" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="stuff">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form> ​
<script type="text/javascript">
$(function(){
$('#button').click(function(e){
if ($('#terms').prop('checked') == false) {
alert('Please accept the terms and conditions');
e.preventDefault();
}
else {
// Allow the button the do its thing
}
});
});​
</script>

AWEBER javascript integration

i have 2 raw aweber html code, they are in separate accounts. now i want to have 1 sign up form for this two raw codes. Means when someone sign up on my form, the email should the be saved on my two list. but i got problem on how to integrate this two codes. When i remove 1 form it work for only 1 list but when i integrate the two it doesn't save any email on the two list.
heres my code ,sorry for my poor coding im new to javascript im trying hard to solved this problem hope someone can help me.
<!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" />
<title>Untitled Document</title>
<!--1st-->
<script language="javascript">
function copy_fields(){
<!--document.getElementById('name1').value = document.getElementById('name').value;
document.getElementById('from1').value = document.getElementById('email').value;
}
function validate(){
var filter = /^([a-zA-Z0-9_\.\-])+\#(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if((document.submail.email.value=='')||(document.submail.email.value=='Email Address'))
{alert('Please Enter Email Address'); return false;}
if (!filter.test(document.submail.email.value))
{alert('Please Enter A Valid Email'); return false;}
document.getElementById('sub9').className='gray_out';
document.getElementById('sub9').disabled='true';
copy_fields();
document.form2.submit();
setTimeout('document.submail.submit()',3000);
}
</script>
<style type="text/css">
.gray_out {
filter:alpha(opacity=40);
-moz-opacity:.40;
opacity:.40;
}
</style>
<!--END 1st-->
<!--2nd-->
<script language="javascript">
function copy_fields1(){
<!--document.getElementById('name1').value = document.getElementById('name').value;
document.getElementById('from1').value = document.getElementById('email').value;
}
function validate1(){
var filter = /^([a-zA-Z0-9_\.\-])+\#(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if((document.submail.email.value=='')||(document.submail.email.value=='Email Address'))
{alert('Please Enter Email Address'); return false;}
if (!filter.test(document.submail.email.value))
{alert('Please Enter A Valid Email'); return false;}
document.getElementById('sub9').className='gray_out';
document.getElementById('sub9').disabled='true';
copy_fields1();
document.form1.submit();
setTimeout('document.submail.submit()',3000);
}
</script>
<style type="text/css">
.gray_out {
filter:alpha(opacity=40);
-moz-opacity:.40;
opacity:.40;
}
</style>
<!--END 2nd-->
</head>
<body>
<form name="submail" method="post" action="http://empowerauthoritypro.com/commission-loophole-ninja" >
<input type="hidden" name="go" value="now" />
<!-- First Name:<br />
<input id="name" type="text" name="name" value="First Name" onclick="if(this.value=='First Name') this.value=''" class="text-field" /><br />-->
Email:<br />
<input id="email" type="text" name="email" value="Email Address" onclick="if(this.value=='Email Address') this.value=''" class="text-field" />
<!--Optin Now-->
<input type="button" id="sub9" value="Submit" onClick='window.open(validate1())' />
</form>
<!--1st has email requirement only-->
<form name="form2" method="post" action="http://www.aweber.com/scripts/addlead.pl" target="iframe" style="display:none">
<input type="hidden" name="meta_web_form_id" value="1817364894" />
<input type="hidden" name="meta_split_id" value="" />
<input type="hidden" name="listname" value="dummylistshaq" />
<input type="hidden" name="redirect" value="http://www.aweber.com/thankyou.htm?m=default" /><input type="hidden" name="meta_adtracking" value="ninjatest" />
<input type="hidden" name="meta_message" value="1" />
<input type="hidden" name="meta_required" value="email" />
<input type="hidden" name="meta_tooltip" value="" />
<div style="display:none">
<img src="http://forms.aweber.com/form/displays.htm?id=jByM7MxsLBycLA==" alt="" width="1" height="1" />
</div>
<input type="text" name="email" id="from1" value="" size="20">
</form>
<iframe name="iframe" style="display:none"></iframe>
<!--END 1st-->
<!--2nd has name and email requirement but i have compromise the name to be hide-->
<form name="form1" method="post" action="http://www.aweber.com/scripts/addlead.pl" target="iframe" style="display:none">
<input type="hidden" name="meta_web_form_id" value="1376972149" />
<input type="hidden" name="meta_split_id" value="" />
<input type="hidden" name="listname" value="optinninja1" />
<input type="hidden" name="redirect" value="http://www.aweber.com/thankyou.htm?m=default" /><input type="hidden" name="meta_adtracking" value="ninjaoptin" /><input type="hidden" name="meta_message" value="1" />
<input type="hidden" name="meta_required" value="name,email" />
<input type="hidden" name="meta_tooltip" value="" />
<div style="display:none">
<img src="http://forms.aweber.com/form/displays.htm?id=jMzsbJzsTIwsnA==" alt="" width="1" height="1" />
</div>
<input type="hidden" name="name" id="name1" value="" size="20">
<input type="text" name="email" id="from1" value="" size="20">
</form>
<iframe name="iframe" style="display:none"></iframe>
<!--END 2nd-->
</body>
</html>
A better (and AWeber-supported) way to integrate multiple services with your AWeber list is to use the AWeber API.
Another possibility might be to set up a PHP page on your own site, set it as your AWeber Form's "Thank You Page", and code your PHP to take advantage of the Pass Subscriber Data feature:
https://help.aweber.com/entries/21775518-how-do-i-pass-form-data-to-my-thank-you-pages
I'm a bit confused regarding your desired workflow. You mention submitting to two AWeber lists, yet there is a third form in your code as well that posts to a third party.
I highly recommend getting in touch with AWeber Customer Solutions who will be able to address your needs more comprehensively. Just email help#aweber.com or visit https://www.aweber.com/contact-us.htm and a team member will take an in-depth look.

Categories

Resources