/    Sign up×
Community /Pin to ProfileBookmark

connect MSSQL with Javascript

Can someone welp me to change the following function,to coonect to MSSQl database,what I want is to select dates from MSSQl,not in the script as it is now.
<script type=”text/javascript”>
$(function() {
// format: specialDays.year.month.day
var specialDays = {
‘2010’: {
‘1’: {‘1’: {tooltip: “New Year’s Day”, className: “holiday”}},
‘3’: {
’21’: {tooltip: “Human Rights Day”, className: “holiday”},
’22’: {tooltip: “Public Holiday”, className: “holiday”}
},
‘4’: {
‘2’: {tooltip: “Good Friday”, className: “holiday”},
‘4’: {tooltip: “Easter Sunday”, className: “holiday”},
‘5’: {tooltip: “Family Day”, className: “holiday”},
’27’: {tooltip: “Freedom Day”, className: “holiday”}
},
‘5’: {‘1’: {tooltip: “Workers Day”, className: “holiday”}},
‘6’: {
’16’: {tooltip: “Youth Day”, className: “holiday”}},
‘8’: {‘9’: {tooltip: “Women’s Day”, className: “holiday”}},
‘9’: {’24’: {tooltip: “Heritage Day”, className: “holiday”}},
’12’: {
’16’: {tooltip: “Day of Reconciliation”, className: “holiday”},
’25’: {tooltip: “Christmas Day”, className: “holiday”},
’26’: {tooltip: “Day of Goodwill”, className: “holiday”},
’27’: {tooltip: “Public Holiday”, className: “holiday”}
}
}
};
$(‘#datepicker’).datepicker({beforeShowDay: function(date) {
var d = date.getDate(),
m = date.getMonth()+1,
y = date.getFullYear();

if (specialDays[y] && specialDays[y][m] && specialDays[y][m][d]) {
var s = specialDays[y][m][d];
return [true, s.className, s.tooltip];
}
return [true,”]; // no change
}});

});

</script>

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Aug 31.2010 — You would need to use a serverside language to connect to the database since JavaScript does not have the ability and it would not be secure since you password/connection string would be in plain sight.

Eric
Copy linkTweet thisAlerts:
@BigNoseauthorAug 31.2010 — After connecting to the MSSQL database using PHP,how do I pass those values I select from database to javascript function.
Copy linkTweet thisAlerts:
@A1ien51Aug 31.2010 — After connecting to the MSSQL database using PHP,how do I pass those values I select from database to javascript function.[/QUOTE]

Write it out to the page like you would any other text. The backend has no clue what it is it is outputting.

Eric
×

Success!

Help @BigNose spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...