Updating or saving new event

When do i fire the update or save new event with this code:

//saving the event
scheduler.attachEvent("onEventSave", function(id,ev,is_new){
	var schedData = {};
        schedData["id"] = id;
	schedData["scheduleTitle"] = ev["text"];
	schedData["userId"] = ev["section_id"];
	schedData["startDate"] = ev["start_date"];
	schedData["endDate"] = ev["end_date"];
	schedData["recurringPattern"] = ev["rec_pattern"];
	schedData["recurringType"] = ev["rec_type"];
  if (!ev.text) {
    alert("Event title must not be empty.");
    return false;
		 $scope.postUrl = 'schedule/update';
               $scope.postUrl = 'schedule/add';
	$http.post($scope.postUrl, schedData).success(function(data) {
      }).error(function(data) {
  return true;

the problem here the is_new variable is always undefined. Thanks

it’s hard to say where’s the problem without a demo. In general when event is new the variable contains the creation date, if not - “null”.

Based on this documentation: docs.dhtmlx.com/scheduler/api__s … event.html
is_new variable return a boolean.

Thanks for the idea. I got it.