addressalign-toparrow-leftarrow-leftarrow-right-10x10arrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblightning-boltlinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstar-shapestartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Need Help With jQuery

From: Greg T.
Sent on: Tuesday, August 13, 2013, 4:58 PM
Am try to pass a variable (myVar) by reference into a
click function.  How do I get the correct value of myVar
outside the click function.  Thanks.  Greg

Here is my code:

     var data = {myVar:0};
     $('a[href*="'+matchS­tr+'"]').click (data,function (e) {
         if ($.cookie ('IDXplosionPOP_clic­k_count') == null)    {
             $.cookie ('IDXplosionPOP_clic­k_count', 1, { path: '/', 
expires: 180, domain: cookieDomain });
             e.data.myVar = 1;
         }
         else {
             var num = Number ($.cookie ('IDXplosionPOP_clic­k_count'));
             $.cookie ('IDXplosionPOP_clic­k_count', num + 1, { path: 
'/', expires: 180, domain: cookieDomain });
             e.data.myVar = num+1;
         }
     });
    console.log (data.myVar);  // always displays 0

-- 
Greg Turner, M.A.
https://www.ZenOfW...­
[masked]

People in this
group are also in: