Solved

jquery datepicker

Posted on 2012-03-28
9
370 Views
Last Modified: 2012-03-29
I am facing a very weird situation.

I downloaded the source code of datepicker from http://jqueryui.com/demos/datepicker/default.html

i saved default.html on c:

when i run c:\default.html it works perfectly fine.

i copied the same file to my server and ran it from server http://10.0.1.2/default.html

it does not work????

I have been trying to figure out this since more than a week now. Please advice.
0
Comment
Question by:genius_geek
9 Comments
 
LVL 17

Expert Comment

by:OmniUnlimited
ID: 37780264
It looks like the server ip is not actually available on the Internet?
0
 

Author Comment

by:genius_geek
ID: 37780272
it is not. it is a local ip on the development machine. but that is not an issue...
i mentioned the ip to give a reference. only i can access the ip. i have many other pages on the ip, php, other jquery dynamic forms... they all work fine with the ip.

The point is datepicker is not working.
0
 
LVL 17

Expert Comment

by:OmniUnlimited
ID: 37780295
OK, and forgive me if I say the obvious, but you have double checked the links on the page, the script url's, etc. and they all check out as being connected and the files are being accessed correctly?
0
 

Author Comment

by:genius_geek
ID: 37780302
i think its the problem with script urls and link urls... since i am a beginner at jquery, i dont hv basic foundation knowledge of what scripts are compulsory while using jquery ui

this is all i have

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="http://jqueryui.com/themes/base/jquery.ui.all.css">
<link rel="stylesheet" href="http://jqueryui.com/demos/demos.css">

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script src="http://jqueryui.com/ui/jquery.ui.core.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.js"></script>
<script src="http://jqueryui.com/ui/jquery.ui.widget.js"></script>
<script src="http://jqueryui.com/ui/jquery.ui.datepicker.js"></script>

Open in new window


I need someone to help me identify, if something is missing? or is anything not required?
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 17

Assisted Solution

by:OmniUnlimited
OmniUnlimited earned 100 total points
ID: 37780314
Wow, yeah, you have a lot of unnecessary stuff there.  You probably are running into conflicts.  I would recommend that you download a custom theme from http://jqueryui.com/themeroller/.  Select the "Gallery" tab from the sidebar on the left, select the look you want, and click on "Download" to move to the download page, then click on the "Download" button there to download the custom theme zip file.

Decompress it, and the only real files you need will be the two javascript files from the js folder and the files from the CSS folder.  Make sure that the paths are right to these files on your server, then everything should work.  I'd take out the rest of those links and scripts.
0
 
LVL 17

Assisted Solution

by:sonawanekiran
sonawanekiran earned 150 total points
ID: 37780320
I think you just need
<link rel="stylesheet" href="http://jqueryui.com/themes/base/jquery.ui.all.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.js"></script>
<script src="http://jqueryui.com/ui/jquery.ui.datepicker.js"></script>

Open in new window


Again try with class instead of id

like

<html>
<head>

<link rel="stylesheet" href="http://jqueryui.com/themes/base/jquery.ui.all.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.js"></script>
<script src="http://jqueryui.com/ui/jquery.ui.datepicker.js"></script>

<script type="text/javascript">
$(document).ready(function(){
 
  $(function() {
    $( ".myDatePicker" ).datepicker(); // [b]see myDatePicker [/b]
  });

});

</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" class="myDatePicker"></p>
</body>
</html>

Open in new window

0
 
LVL 17

Expert Comment

by:OmniUnlimited
ID: 37780336
The only problem I see with sonawanekiran's solution is that it relies on a third party's site, in this case ajax.googleapis.com.  If that's what you want to do, you can do that as well, but my solution provides greater flexibility, reliability, speed, control and customization.
0
 
LVL 4

Accepted Solution

by:
Nguyen Doan Tien earned 250 total points
ID: 37780382
There are some difference url resources (stylesheet, javascript) in default.html file
In your case, here is the best soultion to run default.html:
1) Download all resource on your local disk
2) re-config src url in default.html file
=> I have built and tested datetime picker, please see the attachment file and copy to your server and run it again.
datetimepicker-demo.zip
0
 

Author Closing Comment

by:genius_geek
ID: 37785187
thanks nguyen. it was a perfect demo & solution.
thanks sonawanekiran and omniunlimited. cheers.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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…

743 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

11 Experts available now in Live!

Get 1:1 Help Now