Solved

jquery ui datepicker on select update the database

Posted on 2013-05-16
4
582 Views
Last Modified: 2013-05-23
I have a jquery ui datepicke. What I trying to do is on date selection update the database. And along with the date I need to pass the ID to the dataabse.

I do not seems to be able get it to work

<input id="3" class="datepicker hasDatepicker" type="text" value="" placeholder="Select Date..." readonly="readonly">


                        $(".datepicker").datepicker({
                              inline: true,
                              nextText: '&rarr;',
                              prevText: '&larr;',
                              showOtherMonths: true,
                              dateFormat: 'mm/dd/yy',
                              dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
                              showOn: "button",
                              buttonImage: "img/calendar-blue.png",
                              buttonImageOnly: true,
                               onSelect: function(date) {
                                     var val = $(this).attr('id');


                                },
                        });
0
Comment
Question by:erikTsomik
  • 2
4 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39171815
Hi,
which database? For updating data you normally have to use some kind of server side code rather than client side javascript.
Which type of ASP.NET web app do you have?
Thanks and HTH
Rainer
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 39171871
it is OK. I will jquery ajax functiomn and pass the data to the server side. I just need to know why I can not pass it the ajax
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 39172076
DO wee have any updates on this
0
 
LVL 2

Accepted Solution

by:
Immanuel Phillips earned 500 total points
ID: 39174089
I don't see why you cannot pass it via AJAX. You have correctly initialized the datepicker widget, but are not doing anything with the data that's being selected. You need to use AJAX to send a POST request to pass the data.

$.ajax({
  type: "POST",
  url: url,
  data: data,
  success: success,
  dataType: "json"
});

You can find more information on AJAX POST here: http://api.jquery.com/jQuery.post/
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now