php - What's the error with my code? -


i'm using smarty template , php. following code being written in smarty template.

{literal} <script type="text/javascript"> // function gets test when category checkbox checked  function get_subjects_by_class(class_id) {     var field_id = 'subjects';     $.ajax({         url: "teacher_details.php",         type: "get",         data: {             'request_type': 'ajax',             'op': 'get_assigned_subject_list',             'class_id': class_id         },           success: function (data) {             $('#category_test_container').append(data);         });     } </script> {/literal} 

call function follows :

<a href="#" onclick="get_subjects_by_class({$class.class_id}); return false;">{$class.class_name}</a> 

upon clicking on hyperlink i'm getting error follows :

referenceerror: $ not defined $.ajax({ 

i googled error resolution, couldn't desired resolution. can me out resolve error? in advance.

you either haven't loaded jquery or you've loaded after you've run script. why $ undefined.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -