0

我试图加载 Datepicker,以便以后可以将值添加到 json 请求。但似乎我什至无法在文本框中加载日历。想法是获取输入日期并在 json 中请求它。

好吧,我可以提一下,如果没有 datepicker 功能,它可以正常工作。

// Portlet JSP in Liferay 
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:resourceURL var="resourceURL">
</portlet:resourceURL>

<portlet:defineObjects />

// jQuery UI sources
<link rel="stylesheet"
      href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

// Jquery and Ajax Source      
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
</script>

// JS Function
<script>
$(document).ready(function() {
        // Load Date Picker in input box But not working

        $( "#datepicker" ).datepicker();        

                            $("#btn").click(function() {
                                $.ajax({
    // Reso
                                    url : '${resourceURL}',

                                    data : {
                                        "PersonID" : $('#PersonID').val(),
                                        "AnotherD" : 2
                                    },//person id to sent, In place of Anotherd I want to add Datevalue
                                    type : 'POST',
                                    dataType : "json",
                                    success : function(data) {
                                        console.log(data);
//Getting Data in return
                                        var x = data.PersonList[1].PersonWeight;
                                        $("#Results").text(x);
                                        $("#Res").text(data.PersonList[1].PersonTemp);

                                    }
                                });
                            });
                        });
                    </script>

                    <body>

  // Out Put Data                  
                        PersonID:
                        <input type="text" name="PersonID" id="PersonID">
                        <br>

// Date Picker Textbox   
                        <br>
                        <p>
                            Date: <input type="text" id="datepicker" />
                        </p>

// Refresh Button
                        <button id="btn">Refresh</button>


                        <br>Height :
                        <p id="Results"></p>
                        <br> Weight:
                        <p id="Res"></p>



                    </body>

但它不起作用,有什么建议吗?

4

1 回答 1

0

Remove this line. I think jQuery conflicts is occurring in your case

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
</script>

HTH

于 2013-07-25T06:21:58.747 回答