Solved

jquery ui datepicker on select update the database

Posted on 2013-05-16
4
585 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

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 …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

823 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