English 中文(简体)
日期: 摩纳哥 如果日历月通过快速点击而迅速点击,那么淋巴登临JSON的要求就能够保持稳定。
原标题:datePicker onMonthChange & beforeShowDay getJSON request can t keep up if calendar month quickly clicked through

我尝试并保持这一节奏。

页: 1 设置了供住宿网站使用的设备,以在日期/日期上进行检查。 使用<代码>在ShowDay前索取含有日期和比率的XML文件。 我开始这样做,是正确的。

当月变更时,我有<代码>MonthChange功能,可以重新索阅以下月/过去几个月的信息,但其中一个重要部分除外:

The Problem: If you quickly click through the months the XML data coming back in can t keep up, so dates incorrectly show as unavailable.

www.un.org/Depts/DGACM/index_spanish.htm 我需要以下一点:

  • Once the data loads the calendar refreshes to show the correct availability
  • The month forward button is disabled until the data has been loaded.

What I ve Tried

  • Hiding the month change button at the start of the onMonthChange function then showing it at the end - this doesn t work.
  • Using async:false in the get function - I feel this is the solution but I can t get it work as I can t find any clear documentation on where it s meant to go.

<><>Code>:

        /* Date Picker */
    var datepickerOptions = {
        dateFormat:  yy-mm-dd ,
    };
    var checkInOptions = {
        showOtherMonths: false,
        minDate: 0,
        beforeShowDay: addPrice,
        onSelect: openCheckout,
        onChangeMonthYear: onMonthChange,
        dateFormat:  yy-mm-dd 
    };

    j.getJSON("/availability.php?startDate="+year+"-0"+month+"-01&id="+j( #property_id ).text(),
      { format: "json" },
      function(data) {
            document.pricesData = data;
            document.firstDate =   ;
            j( #calendar_check_in ).datepicker(checkInOptions);

            /* Tip Tip */
            j( .ui-datepicker-calendar td ).tipTip({ defaultPosition: "right" });

            for (var key in document.pricesData) {
               var obj = document.pricesData[key];
               if(obj[ avail ] == 1 && document.firstDate ==   ){
                  document.firstDate = key;
               }
            }
            d = new Date(document.firstDate.substr(5));
            d.setMonth(d.getMonth()+1);

      });

function addPrice(date) {
    calDate = new Date(date);
    dateString =  date_ +calDate.getFullYear()+ - +( 0 +(calDate.getMonth()+1).toString()).substr(-2)+ - +( 0 +(calDate.getDate()).toString()).substr(-2);
    if(document.pricesData[dateString] != undefined){
        var priceString = document.pricesData[dateString][ price ];
        if(document.pricesData[dateString][ avail ] == "1"){
            valid = true;
        } else {
            valid = false;
        }
    }else{
        var priceString =  Price not available ;
        valid = false;
    }
    return [valid,   , priceString];
}

function onMonthChange(year, month, inst){
    /* Date Picker */
    month--;
    j.getJSON("/availability.php?startDate="+year+"-0"+month+"-01&id="+j( #property_id ).text(),
      { format: "json" },
      function(data) {
            document.pricesData = data;
            document.firstDate =   ;
            /* Tip Tip */
            j( .ui-datepicker-calendar td ).tipTip({ defaultPosition: "right" });

            for (var key in document.pricesData) {
               var obj = document.pricesData[key];
               if(obj[ avail ] == 1 && document.firstDate ==   ){
                  document.firstDate = key;
               }
            }
            d = new Date(document.firstDate.substr(5));
            d.setMonth(d.getMonth()+1);
      });
}

由于需要时间阅读的人,希望有人会找到某种解决办法,因为此时此刻,它就是一个 show的bit子!

谢谢!

最佳回答

If you quickly click through the months the XML data coming back in can t keep up, so dates incorrectly show as unavailable.

当用户变更日期时,你能否清楚了解目前展示的定价和可用信息? 这样,至少你就没有显示不正确的数据。 然后,如果需要,你可以添加一些信息,告知用户,其他数据仍在装上。

我强烈建议不要试图使用合成:false。 这同核选择一样。 这将对网站产生其他不利影响,而且对你来说确实需要这种不利影响。

问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签