⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Javascript not working



JerothKP
  • profile picture
  • Member

Posted 06 March 2013 - 12:16 PM

Hi, I'm using Grocery Crud an I have some doubts because I want to use a callback in a field with some javascript code but it doesn't work.

 

If I add this: "<script src=\"http://code.jquery.com/jquery-1.9.1.js\"></script>" before my javascript code inside the callback works fine but kind of disables the ones I load in the view file.

 

How can I add the .js without disabling the ones I load in the view?

 

Thanx in advance, this is a great plugin ;)


sachin vairagi
  • profile picture
  • Member

Posted 06 March 2013 - 14:40 PM

i think your javascript is not loading due to wrong src, remove '\' from the end of src after .js

 

link should be http://code.jquery.com/jquery-1.9.1.js

 

may be it will help you.


JerothKP
  • profile picture
  • Member

Posted 06 March 2013 - 14:49 PM

sorry, I put it wrong in the post I have <script src="http://code.jquery.c...query-1.9.1.js"></script> already

sorry again :P


sachin vairagi
  • profile picture
  • Member

Posted 06 March 2013 - 15:02 PM

may be your javascript is confict,

try

<script type="text/javascript">
var nc = $.noConflict();
// your code.
</script>
 
and replace all $ sign inside javascript code by 'nc'. you can check the link below for more info
 

JerothKP
  • profile picture
  • Member

Posted 06 March 2013 - 15:39 PM

It worked perfectly!! thank you so much ^_^

Although I think it's not showing the success message if I don't go back to the table :P

 

Edit: yeah it's not appearing, why could it be?


sachin vairagi
  • profile picture
  • Member

Posted 06 March 2013 - 16:23 PM

please show your code.


JerothKP
  • profile picture
  • Member

Posted 07 March 2013 - 08:21 AM

$crud->unset_jquery();
$crud->unset_jquery_ui();

 

this two lines before the render where guilty :P

 

thanks anyway

 

 

Edit: well, it works fine when editing but if I'm adding stuff it shows a 'loading, saving' label, the item is added properly but the message never shows up  :(


JerothKP
  • profile picture
  • Member

Posted 15 March 2013 - 10:57 AM

Solved using 

$(window).load()

 

instead of 

$(document).ready()

 

in my jQuery code ^^


William Schoeffel
  • profile picture
  • Member

Posted 22 April 2013 - 17:18 PM

this topic help me a lot, thanks guys!