简体   繁体   English

Django-Stripe-Payments在发布时将Json转储到浏览器

[英]Django-Stripe-Payments dumps Json to browser on post

So I'm having a similar problem to Django AJAX JSON response appears as raw text in browser or Django-stripe-paymants and eldarion-ajax subscribe JSON response but I can't find this second reference to jQuery and I've also tried multiple versions of jQuery. 所以我遇到了与Django AJAX相似的问题JSON响应出现在浏览器Django-stripe-paymants和eldarion-ajax订阅JSON响应中的 原始文本中,但是我找不到第二个jQuery引用,我也尝试了多次版本的jQuery。 Their payment is processed and the web hooks look good just like them. 他们的付款已处理完毕,并且网页挂钩看起来也像他们一样不错。

I haven't gotten any help so far but I could probably solve my problem with any of the following: 到目前为止,我还没有得到任何帮助,但是我可以通过以下任何一种方法解决问题:

  1. other reference repositories of people using django-stripe-payments 使用django-stripe-pays的人的其他参考资料库
  2. A walk though of how to get django-stripe-payments workings because the requirements page is not enough so far. 到目前为止,如何获得django-stripe-pays的工作方法尚不完善。

I've created a bare essentials version needed for the stock version django-stripe-payments to work and the problem still persists. 我已经创建了一个基本的基本版本,该版本需要股票版本django-stripe-payments起作用,问题仍然存在。

I created a virtualenv and pip installed django, then django-stripe-payments and django-forms-bootstrap. 我创建了一个virtualenv并在dip中安装了django,然后安装了django-stripe-payments和django-forms-bootstrap。 Those installs included both django-jsonfield and stripe. 这些安装包括django-jsonfield和stripe。 So pip shows I have the following 所以点显示我有以下内容

Django==1.6.5
argparse==1.2.1
django-forms-bootstrap==3.0.0
django-jsonfield==0.9.13
django-stripe-payments==2.0b34
pytz==2014.4
requests==2.3.0
stripe==1.19.0
wsgiref==0.1.2

My site_base.html is 我的site_base.html是

<script src="/static/js/jquery-1.9.1.min.js"></script>
<script src="//checkout.stripe.com/v2/checkout.js"></script> 

<script>
$(function() {
    $('body').on("click", '.change-card, .subscribe-form button[type=submit]', function(e) {
      e.preventDefault();
      var $form = $(this).closest("form"),
          token = function(res) {
            $form.find("input[name=stripe_token]").val(res.id);
            $form.trigger("submit");
          };

      StripeCheckout.open({
        key:         $form.data("stripe-key"),
        name:        'Payment Method',
        panelLabel:  'Add Payment Method',
        token:       token
      });

      return false;
    });
});
</script>

{% block title %}
{% endblock %}

{% block body %}
{% endblock %}

<script src="static/js/eldarion-ajax.min.js"></script>

when I try and change a payment plan I get the proper GET but on the post I believe it isn't linking with jQuery 当我尝试更改付款计划时,我得到了正确的GET,但在帖子中,我认为它未与jQuery链接

[20/Aug/2014 20:06:33] "GET /payments/change/plan/ HTTP/1.1" 200 2063
[20/Aug/2014 20:06:33] "GET /payments/change/plan/static/js/eldarion-ajax.min.js HTTP/1.1" 404 4139
[20/Aug/2014 20:06:37] "POST /payments/a/change/plan/ HTTP/1.1" 200 1394

这是因为它旨在与http://github.com/eldarion/eldarion-ajax (或您自己的AJAX处理)一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM