Solved

jquery ui datepicker on select update the database

Posted on 2013-05-16
4
593 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
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)

688 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