Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$.request is not a function #18

Open
gorny-dev opened this issue Aug 30, 2019 · 0 comments
Open

$.request is not a function #18

gorny-dev opened this issue Aug 30, 2019 · 0 comments
Assignees

Comments

@gorny-dev
Copy link

gorny-dev commented Aug 30, 2019

I want to use your package (@lovata/shopaholic-cart/shopaholic-cart-add)

I got a problem with with AJAX request inside file 'dist/app.js' (created by webpack).

app.js file:
import 'popper.js';
import 'bootstrap';

$(function () {
$.request('Cart::onAdd', {
'update': {'cart-items': '.cart-item-wrapper'}
});
});

that throws an error:

jQuery.Deferred exception: $.request is not a function TypeError: $.request is not a function
at HTMLDocument. (http://localhost/dental/combine/b71d14df8c4d4ddba2c49a7f4750930f-1567079039.js:1232:5)
at mightThrow (http://localhost/dental/combine/b71d14df8c4d4ddba2c49a7f4750930f-1567079039.js:9406:29)
at process (http://localhost/dental/combine/b71d14df8c4d4ddba2c49a7f4750930f-1567079039.js:9474:12) undefined

when i put this in html file (layout.htm)

    <script type="text/javascript" src="{{ [
        '@jquery',
        '@framework',
        '@framework.extras',
        'assets/dist/js/app.js',
        ]|theme }}.js">
    </script>
    {% scripts %}
    <script>
        $(function () {
            $.request('Cart::onAdd', {
                'update': {'cart-items': '.cart-item-wrapper'}
            });
        });
    </script>

it works correct

{% put script %} also works correct

The problem is with the file generated by webpack
Jquery in webpack is fine

How to use that $.request with your package?

Ive already asked about that at octobercms :
octobercms/october#4582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants