Jump to content

prestashop module throws an error when one function is called


Recommended Posts

Hi,

In prestashop I am doing a small module. In that module my codes are something like this

 

private function _displayForm() {

  $this->_html .= '

     <link rel="stylesheet" href="../modules/newmodule/css/validationEngine.jquery.css" />
     <script type="text/javascript">
     jQuery(document).ready(function() { 
       function loadinit() {
       alert(\'hiiiiii\');
     [spam-filter]);
    </script>
     <script src="../modules/newmodule/js/jquery.min.js" type="text/javascript" charset="utf-8">
     <script src="../modules/newmodule/js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"> 
     <script src="../modules/newmodule/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8">
   ';


   $this->_html .= '<div>
   <script type="text/javascript">loadinit();</script></div>';
}

 

Now you can see that I have made a function called

loadinit()

and I have called that function at very bottom. But when I load the page it throws me an error in firefox console tab

ReferenceError: loadinit is not defined
loadinit();

So can someone kindly tell me why this error is coming here and how to fix this? Any help and suggestions will be really appreciable. Thanks..

Link to comment
Share on other sites

your jQuery object is defined?

why not $ ?

 

I am doing a simply alert to check here and I have used jQuery instead of $. When I used $ instead of jQuery it showed me an error in console panel

TypeError: $ is not a function $(document).ready(function() {

. Can you tell me how to solve this issue.

Edited by prestashop_newuser (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...