var how_many_checked= ''; $.ajax({ type: "POST", url: "/ajax_add_selected_product_to_session.php", success: function(msg){ /* add here what to do on success */ //alert(msg); how_many_checked = msg;
} }); alert(how_many_checked); if(how_many_checked !=undefined) { do some.................................................. } On Wed, Feb 25, 2009 at 5:31 PM, heohni <heidi.anselstet...@consultingteam.de> wrote: > > Hi, > > $.ajax({ > type: "POST", > url: "/ajax_add_selected_product_to_session.php", > success: function(msg){ > /* add here what to do on success */ > //alert(msg); > var how_many_checked = msg; > > } > }); > alert(how_many_checked); > if(how_many_checked > 0) ....... > > > the FF returns "how_many_checked" ist not defined. > Why? > > How can I define a var and use it for a later coming if / else part? > > Thanks a bunch!