Django-stripe-paymants and eldarion-ajax subscribe JSON response - ajax

I am working with Django-stripe-paymants and it's working except for handling the JSON response after the subscribe form is completed. They payment is processed and the web hooks look good.
But it is just showing the JSON is browser window.
ie:
{"html": "\n\n\n<div class=\"subscribe-form\">\n <h2>Purchase a Subscription.....
I imagine there is something small missing in the Java script, but am stuck.
I have read through the documentation a few times and searched around for a solution. The common cause for this was not including bootstrap-ajax.js. Since the last relevant issue I can find, bootstrap-ajax has been renamed eldarion-ajax.
My base template includes:
<script src="{% static 'js/vendor/checkout.js' %}"></script>
<script src="{% static 'js/vendor/jquery-1.11.0.min.js' %}"></script>
<script src="{% static 'js/vendor/eldarion-ajax.min.js' %}"></script>
Any pointers will be appreciated. Javascript is not my strong point..
Thanks!

I realise it looks like you've figured out an answer to your own question, however I had a very similar issue with my Django-stripe-payments + eldarion-ajax app and I managed to get jQuery v1.11.0 to work ok. Please check here for my answer.

Related

django oscar - Dashboard/voucher

I'm not able to add voucher from the dashboard. The Datetimepicker field doesn't pick the date.
In django-oscar==1.5.1, Django==1.10.8
Thank you
replace <script src="{% static "oscar/js/inputmask/jquery.inputmask.bundle.js" %}"></script>
with <script src="{% static "oscar/js/inputmask/jquery.inputmask.bundle.min.js" %}"></script> in your dashboard/layout.html file. Make sure you have the minified version of the above file in you project's local path.
Django oscar has a feature branch feature/datetime-for-vouchers, refer this for crosschecking and more info.
It worked, Thank you very much it helped me a lot.
Thanks for spending your valuable time, most of them don't answer the question only the few who are passionate about this field

Laravel MIX not working, using CDN does work

I'm a bit lost here. I'm NOT new to Laravel Mix so this is really confusing.
I have a layout blade file and it looks something like this
<html> ....
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0/katex.min.js"></script>
<script src="{{ mix('/js/myjs.js") }}></script>
</body>
</html>
The myjs.js is compiled using Laravel Mix and contains dozen of libraries and all of them compile and work properly.
However if I include this
require('katex'); //so it's above everything else to simulate situation from above, when it's included in the layout file
...
and drop the CDN script from the layout file - the Katex library won't work.
I tried using require('katex/dist/katex.min.js') but still nothing. The katex.min.js file in the library and the one in CDN are the same.
I'm not expert on npm and I only use it to fetch libraries and then merge and minify them in my Laravel app.
Can anyone help me pin point the problem here or point me to what am I doing/getting wrong here?
Shouldn't the
<script src="lib1.js"></script>
<script src="lib2.js"></script>
included in the html, and
require('lib1')
require('lib2')
compiled to
<script src="{{ mix('compiled.js') }}"></script>
produce the same thing?
Thanks!
UPDATE:
I'm using Katex to implement this summernote plugin.
Katex should be installed as:
window.katex = require('katex');

How enable MathJax functionality on Heroku

I am kinda new to both the Python language and the Heroku web interface to web-app deployment. My background is engineering, and MATLAB programming so the whole rails/web scene is new to me. But I am trying to learn the basics for an upcoming project. Towards this end, with the help of a few tutorials around the web, I have managed to successfully couple of Python/NumPy + Flask based apps:
https://matrix-spectrum.herokuapp.com/
https://plot-damped-sinusoid.herokuapp.com/
But as you can already see, in the second link, the LaTeX/MathJax mark-up is not displaying correctly. Whenever I run it on my localhost it works correctly (heroku local web), but once it is deployed that MathJax does not display.
How do I fix this? Why isn't adding:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
equationNumbers: { autoNumber: "AMS" },
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
}
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
in the header working? The closest question/answer I can find is:
https://groups.google.com/forum/#!topic/mathjax-users/Rpa_WQ6rMkE
But that is about 5 years, old and I suspect there should be more recent developments like:
https://github.com/pmq20/mathjax-rails
But I have no experience with "rails".
Those links use the HTTPS (encrypted HTTP) protocol, but modern browsers often refuse to load unencrypted content if the main connection is encrypted. This is called mixed content.
Your link to load the MathJax library hard-codes an unencrypted HTTP connection:
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
You could switch http:// for https://, but a better approach is probably to simply use //:
<script type="text/javascript"
src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
This makes your link protocol-relative; it will load using the same protocol as the page itself.
I encourage you to learn about your browser's developer tools, which are a great resource when doing web development. The console included there often reveals this type of problem.

jQuery Tags Manager – page is going to be reloaded with get variable

I've tried to implement the jQuery Tags Manager (http://welldonethings.com/tags/manager) the last days in vain...
What the environment looks like:
it is a bootstrap powered website with several elements on it which should be able to be tagged (within a bootstrap modal).
What I have done so far:
I have added the tagManager class to my input field.
<form>
<input type="text" name="tags_0" placeholder="Tags" class="tagManager">
</form>
Furthermore, in the head section of my website I have included a custom javascript file:
<script type='text/javascript' src="js/javascript.js"></script>
The file looks like this:
jQuery(".tagManager").tagsManager();
Of course also the jQuery lib and the bootstrap & TagsManager css files were included.
However when ever I am entering a tag it does reload the website with the get-variable "?tags_0=test"
I am kind of frustrated right now. It seems so simple, but I cannot get it working...
Best regards,
Nico
This probabily isn't going to help the original poster since this was asked some time ago, but I was having the exact same problem and when I searched for help I found this question, so my answer might help someone that ends up here with the same problem.
I was trying to use this jQuery plugin as well and I was having a hard time to get it working too. Spent hours checking the code and searching for help but always got to the conclusion that the code was correct, so I had no idea what was wrong. However, somehow, it then started working.
One thing I noticed was that if I had the call for the css file first and then the js files, it would show some weird thing in the place where it should have the "x" for deleting the tag. But if I called the js files first and then the css file, it would work perfectly.
This is the code I used:
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap-tagmanager.js"></script>
<link href="bootstrap-tagmanager.css" rel="stylesheet" type="text/css">
</head>
<body>
<input type="text" name="products" placeholder="Add your Products" class="tagManager">
<script>
jQuery(".tagManager").tagsManager();
</script>
</body>
Hope this helps someone.

How to cache the static java scripts in asp.net mvc 3

I want to cache 3-4 scripts which is called in master page , how can i do that , any suggestions or tutorial will be help full.
Thanks
Regards
Static files such as javascripts and CSS are already cached by clients browsers. So no need to do anything special. Simply reference them as usual: <script type="text/javascript" src="..."></script>.

Resources