简体   繁体   English

如何在使用 Ajax 的 api 调用中的 javascript 中创建这种类型的数组

[英]How to create this type of array in javascript in api call using Ajax

"Official_time": { 
            "1": { 
                    "from" : "10:00 am", 
                    "to" :"5:00 pm" 
                }, 
            "3": { 
                    "from" : "10:00 am", 
                    "to" :"5:00 pm" 
                } 
}

I want when "I am select first day of week than I will get its value one and like each day I get Its value like 1 to 7 but if I am select days than only its value 1 to 7 gets. I am using checkbox for days.我想要当“我选择一周的第一天,然后我会得到它的值,就像每一天我得到它的值像 1 到 7,但如果我选择天,那么只有它的值 1 到 7 得到。我正在使用复选框天。

Another things is I need store 'open time' & 'close time' so I using time picker.另一件事是我需要存储“开放时间”和“关闭时间”,所以我使用时间选择器。

So how Can I create single array in javascript for this all value like show in array, and can I call in javascript using Ajax?那么如何在 javascript 中为所有值创建单个数组,例如在数组中显示,我可以使用 Ajax 在 javascript 中调用吗?

假设您根据自己的喜好将所有时间存储在 php 数组中,这里是将 php 数组转换为 JSON 的一个很好的起点: json_encode

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM