Announcement

Collapse
No announcement yet.

Help integrate js library

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help integrate js library

    Hi,

    how can I add and integrate a js library in sc?
    someone can help me?
    This is the library that I would like to integrate

    http://demos.9lessons.info/jnotifica...20notification

  • #2
    there are 2 easy ways to do it:

    1.- Copy the required file to you sc environment and use an echo at the on applicationinit event

    PHP Code:
    echo '<script type="text/javascript" src="path_onserver/jquery_v_1.4.js"></script>';
    echo 
    '<script type="text/javascript" src="path_onserver/jquery_notification_v.1.js"></script>'
    then in your events you should use the sc macro for callin js

    PHP Code:
    /**
     * Call a Javascript function after an AJAX call
     */

    // Javascript function parameters
    $javascript_function   'ShowNotification';  // Javascript function name
    $javascript_parameters = array( // Javascript function parameters, add as many as needed
                                    
    'My message'
     
    );

    // Call javascript function
    sc_ajax_javascript($javascript_function$javascript_parameters); 
    And thats pretty much it.

    Regards

    Comment


    • #3
      sorry but I can not make it work, so I tried to:

      onapplicationinit event i add this code:

      echo '<script type="text/javascript" src="path_onserver/jquery_v_1.4.js"></script>';
      echo '<script type="text/javascript" src="path_onserver/jquery_notification_v.1.js"></script>';

      in ajax event onchange of field i add:


      $javascript_function = 'ShowNotification'; // Javascript function name
      $javascript_parameters = array( // Javascript function parameters, add as many as needed
      'My message'
      );

      // Call javascript function
      sc_ajax_javascript($javascript_function, $javascript_parameters);

      but it does not work, what I did wrong?
      thanks to the help

      Comment


      • #4
        You need to replace "path_onserver" with your actual path to the JS

        Comment


        • #5
          Obviously i had already changed the path with the correct one, the problem is that the missing css include

          add this and work:

          echo '<link href=""path_onserver/jquery_notification.css" type="text/css" rel="stylesheet"/>';

          now comes the bar but I can not write anything as message.

          why?
          Last edited by marcov; 03-06-2015, 08:16 AM.

          Comment


          • #6
            in your on application init add the path for the style with an echo.

            PHP Code:
            echo '<link href="<path_to_your_css>/jquery_notification.css" type="text/css" rel="stylesheet"/>'
            Regards

            Comment


            • #7
              I added the code to oninit, and exits the popup but I can add text to popup

              Comment

              Working...
              X