i followed a video about integrating Django with PayPal, I did like he did exactly, with this code:
{% block script %}
<script src="https://www.paypal.com/sdk/js?client-id=AcNrdRh7kSF3PCa6_eS3i0Hyg_EOiwOZ75NfQ0NZQVUpxZCpReVeRuvq28_jfiWzsutpBwNpC8gGnT2V¤cy=USD"></script>
<script>
paypal.Buttons({
//validate the payment form
onClick: function (data, actions) {
var fname = $("[name='fname']").val();
var lname = $("[name='lname']").val();
var email = $("[name='email']").val();
var phone = $("[name='phone']").val();
var address = $("[name='address']").val();
var city = $("[name='city']").val();
var state = $("[name='state']").val();
var country = $("[name='country']").val();
var pincode = $("[name='pincode']").val();
var token = $("[name='csrfmiddlewaretoken']").val();
if (fname == "" || lname == "" || email == "" || phone == "" || address == "" ||
city == "" || state == "" || country == "" || pincode == "" || token == "") {
swal("Alert !", "All fields are mandatory", "error");
return false;
} else {
return true;
}
},
before adding this code, everything was working correctly, after this code shows me this message in browser console:
Uncaught ReferenceError: $ is not defined at Object.onClick