Solved

jquery ui datepicker on select update the database

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

762 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

19 Experts available now in Live!

Get 1:1 Help Now