Question

jQuery issue with website after migration to digital ocean

Posted December 3, 2020 278 views
Ruby on RailsPHPJavaScript

Hello,

So after migrating to digital ocean I have some issues with my website that was not present before, my website is e-commerce the problem is that whenever I try to list a new product it gets created but it’s not showing up in the homepage I tried inspect with chrome and I got a bunch of errors, some of them are jquery errors that was not present before, did I miss something that I need to install on the droplet?

you can see screenshot of the inspect errors here

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello srrefha.

The message ’$ is not defined’ makes me think that maybe the jQuery library is not loading correctly.

You can use the “View page source” option of the browser to access the ‘script’ tag that the jQuery library loads and thus verify if the link in that tag is valid and the jQuery JavaScript code is displayed.

Do you have a public link to your website that I can access to better analyze it?

Greetings.

  • Yes you can access the website here

    The website is in Arabic by default, but if you scroll down you can change it to English.

    • Hello again.

      I have just analyzed your website (the information the web browser provides about it).

      The message “$ is not defined” is because there is JavaScript/jQuery code before adding the jQuery library, for example:

      <script>
              var reload = 0;
              $(document).ready(function(){
                  $('[data-toggle="tooltip"]').tooltip();
              });
      </script>
      

      appears many lines before:

      <script src="/js/jquery.js"></script>
      

      at the root of the website. This problem can be solved by placing the invocation of jquery.js before the scripts that are causing the problem, or by placing those scripts after the invocation of jquery.js.

      Still it doesn’t seem to me that this is related to the new product display issue, that seems to be a backend issue, some caching system, or maybe your backend keeps connecting to the old database on the old server.

      I’m sorry I can’t help you more, regards.