search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How to set value of result in a modal window ajax request?

Asked by Snehal Patel
6 years ago.

set this in the ajax code

but in the parent window "this.result" returns an object, and so cant check against if(this.result == "OK")
any help is much appreciated.


Answer posted by Dan Letecky [DayPilot]
6 years ago.

You are using the server-side syntax:

Modal.Close(this, "OK");

On the client side, it has only one parameter:

Comment posted by Snehal Patel
6 years ago.

super! Thanks Dan

Comment posted by Snehal Patel
6 years ago.

Another thing, how do i do the commandcallback for refresh, not sure abt the server/client code as to what goes where?

Comment posted by Dan Letecky [DayPilot]
6 years ago.

The .commandCallBack() method only makes sense with DayPilot editions that come with the built-in server-side part (i.e. ASP.NET WebForms, ASP.NET MVC, Java).

It works like this:

1. You call commandCallBack() on the client side.
2. It invokes Command/OnCommand on the server side.
3. In the Command event handler, you update the calendar properties (if needed) and reload the event list.
4. Call Update()
5. It will redraw the calendar on the client side.

For pure JavaScript, you just load events/update properties and call .update() on the client side.

Comment posted by Snehal Patel
6 years ago.

No i am using the javascript version with classic asp as the serverside code, so when i click on an empty cell a modal window opens and when User clicks submit the record is now added in the database but its not in the scheduler yet, so for that i need a way to refresh just the scheduler so the event shows up.
Hope i put it right


Comment posted by Dan Letecky [DayPilot]
6 years ago.

There are two options:

1. You probably have a method that loads events to the calendar similar to this one:

function loadEvents() {
$.post("backend_events.php", function(data) { = data;

This example is from this scheduler tutorial:

So simply call this method to load fresh event set.

2. If you pass the details of the newly-created event back to the main page (from the modal) using ModalStatic.close() you can add just this one using .events.add() method:

// assumes you have access to the new event details
var data = { start: "2014-05-20T10:00:00", end: "2014-05-20T11:00:00", id: "123", text: "New event" };
var e = new DayPilot.Event(data);;

See also:

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.