tNicknames 15 Newbie Poster

Can I do ajax on 'Leave page' button? Below is my code:

window.onbeforeunload = function (event) {
    var message = '';
    if (typeof event == 'undefined') {
        event = window.event;
    }
    if (event) {
        event.returnValue = message;
    }
    return message;
}    
tNicknames 15 Newbie Poster

No body can't solve my problem?

tNicknames 15 Newbie Poster

Still not getting how it is doing?

tNicknames 15 Newbie Poster

Answer is 8 not 6

diafol commented: Aha! +15
tNicknames 15 Newbie Poster

Viewing source im getting _gaq.push statement like this _gaq.push(['_trackEvent', 'Tutor_account', 'Worksheet_assigned', '2307', '1']);

I have included js and setaccount details.

tNicknames 15 Newbie Poster

My localhost is running on self-certified HTTPS and I am using Stripe API. I am getting following errors:

Warning: stream_socket_client() [function.stream-socket-client]: SSL: connection timeout in D:\xampp\htdocs\edplace_live\stripe\stripe\lib\Stripe\ApiRequestor.php on line 374

Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in D:\xampp\htdocs\edplace_live\stripe\stripe\lib\Stripe\ApiRequestor.php on line 374

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://api.stripe.com:443 (Unknown error) in D:\xampp\htdocs\edplace_live\stripe\stripe\lib\Stripe\ApiRequestor.php on line 374

Warning: stream_context_get_params() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\edplace_live\stripe\stripe\lib\Stripe\ApiRequestor.php on line 385

Warning: openssl_x509_export() [function.openssl-x509-export]: cannot get cert from parameter 1 in D:\xampp\htdocs\edplace_live\stripe\stripe\lib\Stripe\ApiRequestor.php on line 389

Fatal error: Maximum execution time of 60 seconds exceeded in D:\xampp\htdocs\edplace_live\stripe\stripe\lib\Stripe\ApiRequestor.php on line 264

tNicknames 15 Newbie Poster

How I can display elements of the following object ? e.g : data -> percent_off

As I stored following like :

$input = file_get_contents("php://input");
$retun_val = json_decode($input);

stdClass Object
        (
        [id] => evt_151H4qEfYJJpTpgqdg5eQvIK
        [created] => 1416575036
        [livemode] =>
        [type] => coupon.created
        [data] => stdClass Object
        (
            [object] => stdClass Object
            (
                [id] => 5D
                [created] => 1416575036
                [percent_off] => 5
                [amount_off] =>
                [currency] =>
                [object] => coupon
                [livemode] =>
                [duration] => once
                [redeem_by] =>
                [max_redemptions] =>
                [times_redeemed] => 0
                [duration_in_months] =>
                [valid] => 1
                [metadata] => stdClass Object(  )
            )
        )
        [object] => event
        [pending_webhooks] => 1
        [request] => iar_5BeN55JpEDjH33
        [api_version] => 2014-10-07
        )
tNicknames 15 Newbie Poster

Fatal error: Uncaught exception 'Google_AuthException' with message 'Error fetching OAuth2 access token, message: 'invalid_grant'' in /var/www/html/edplace/dev2568/cron_files/google-api-php-client/src/auth/Google_OAuth2.php:115 Stack trace: #0 /var/www/html/edplace/dev2568/cron_files/google-api-php-client/src/Google_Client.php(131): Google_OAuth2->authenticate(Array, '4/He7CoB42K1zSX...') #1 /var/www/html/edplace/dev2568/cron_files/cron_job_for_export_and_sent_parent_list_to_google_drive.php(126): Google_Client->authenticate('4/He7CoB42K1zSX...') #2 /var/www/html/edplace/dev2568/cron_files/cron_job_for_export_and_sent_parent_list_to_google_drive.php(7): export_to_csv(Array) #3 {main} thrown in /var/www/html/edplace/dev2568/cron_files/google-api-php-client/src/auth/Google_OAuth2.php on line 115

error_reporting(E_ALL);
ini_set('display_errors', 1);

$clientId = "xxx"; 
$clientSecret = "xxx"; 
$authCode = "4/xxxx"; 

require_once("google-api-php-client/src/Google_Client.php");
require_once("google-api-php-client/src/contrib/Google_DriveService.php");

$client = new Google_Client();
// Get your credentials from the APIs Console
$client->setClientId($clientId);
$client->setClientSecret($clientSecret);
$client->setRedirectUri("http://www.edplace.com/dev2568/cron_files/cron_job_for_export_and_sent_parent_list_to_google_drive.php");
$client->setScopes(array("https://www.googleapis.com/auth/drive"));
$service = new Google_DriveService($client);  
// Exchange authorisation code for access token
if(!file_exists("token.json")) 
{
    // Save token for future use
    $accessToken = $client->authenticate($authCode);      
    file_put_contents("token.json",$accessToken);  
}
else 
$accessToken = file_get_contents("token.json");

$client->setAccessToken($accessToken);

$file = new Google_DriveFile();
$file->setTitle('Parent_'.date('d_M_Y'));
$file->setDescription("Server backup file");
$file->setMimeType("text/csv");
$data = file_get_contents('a.csv');
$createdFile = $service->files->insert($file, array('data' => $data, 'mimeType' => "application/vnd.google-apps.spreadsheet",));