1

Some users show response but some users given net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK) and net::ERR_EMPTY_RESPONSE. Code Used Library (google-api-php-client-master)

Ajax Call
$.ajax({
           url: '/index.php/Syn/getCalandars',
           data: {
               userid: 1            },
           type: 'POST',
           success: function(res) {
               $("#ajax_load_here").html(res);
           }
       });
public function getGoogleCalandarList($client){
        $service = new Google_Service_Calendar($client);
        $calendarList = $service->calendarList->listCalendarList();
        $dropdownarray = array();
        while(true) {
            foreach ($calendarList->getItems() as $calendarListEntry) {
                $dropdownarray[] = array(
                    'id'=>$calendarListEntry->id,
                    'summary'=>$calendarListEntry->getSummary(),
                );
            }
            $pageToken = $calendarList->getNextPageToken();
            if ($pageToken) {
                $optParams = array('pageToken' => $pageToken);
                $calendarList = $service->calendarList->listCalendarList($optParams);
            } else {
                break;
            }
        }
        return $dropdownarray;
    }

public function actionSync(){
  $hasRecord = EmpGoogleCalendar::model()->find('id=' . $_POST['userid']);
            if ($hasRecord != NULL){
                $google_calendar = new GoogleCalendar();
                $client = $google_calendar->Authenticate($_POST['userid']);
                $list = $google_calendar->getGoogleCalandarList($client);
            }
 $this->renderPartial('view',array('list'=>$list));
}

0 Answers0