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
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
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
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
/**
* 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
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
You need to replace “path_onserver” with your actual path to the JS
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?
in your on application init add the path for the style with an echo.
echo '<link href="<path_to_your_css>/jquery_notification.css" type="text/css" rel="stylesheet"/>';
Regards
I added the code to oninit, and exits the popup but I can add text to popup