Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8723923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:43:30+00:00 2026-06-13T07:43:30+00:00

For my jQuery Calendar I need to edit this line of code to insert

  • 0

For my jQuery Calendar I need to edit this line of code to insert a new event.

[
{"id":1, "start": new Date(year, month, day, 12), "end": new Date(year, month, day, 13, 35),"title":"Lunch with Mike"},
{"id":2, "start": new Date(year, month, day, 14), "end": new Date(year, month, day, 14, 45),"title":"Dev Meeting"},
]

file_put_contents would do an awesome job if the “]” wasn’t needed at the last line, so perhaps there is a way to lookup “]” and replace it with:

{"id":3, "start": new Date(year, month, day, 14), "end": new Date(year, month, day, 14, 45),"title":"New Thing"},
    ]

Also, my reservations can be unset, so I also need to find a way to find that specific line (search by ID) and delete it untill the next line…But how can I achieve that?

(This code should be triggered when I’m reserving or unreserving an item.)

Perhaps, if this is even possible, this is not the right way?

What if I set a trigger on the calendar section of the site: before the calendar view is created, the event file will be filled with all the information out of the database, saved, and the calendar then will show all the events.

But how intensive is this for the page? If the database is filled with 1000 reservations, 1002 lines has to be created over and over again every time you check the calendar page. Would this be a good idea?

What are my options here? And which one is the best/right way?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:43:31+00:00Added an answer on June 13, 2026 at 7:43 am

    If you have not much data, call json_decode, add your content, call json_encode on the changed object to make it to a string and save it to the file again ..

    Generally: I would save each line as a json string, but not all in one big object. So simply you have one json object per line:

    {date: "", [...]}
    {date: "", [...]}
    

    You could append an entry while using the “a” flag in fopen(), or FILE_APPEND in file_put_contents(). This is very fast. To read out the data, iterate through each line and call json_decode(). This is faster, too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have jquery calendar code like this <script> $(document).ready(function() { $('#calTwo').jCal({ day: new Date(
I am using jquery mobile datepicker, i need to capture the calendar click event,
In this google calendar, when you click on a date which has an event,
Please help choose jquery event calendar (or other good javascript event calendar) and how
JQuery-ui will generate a div with a calendar-div class. Sadly this div is no
I have the following jQuery code: $(body.page-calendar-practices-2012-05 #content-header h1#title) which works fine. I can
I have the following jquery code: $(document).ready(function() { $(body[class*=page-calendar-practices] #content-header h1#title).after(<div id='athletics_practice-schedule'><div id='inner-title'><a href='www.example.com'
I'm creating an advent calendar and I need a piece of jQuery/Javascript that will
I need a jQuery calendar plugin where I can specify what dates are selectable
I find this Jquery week calendar plugin pretty useful !. I am just wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.