in jQuery how to access an id that is loaded via Ajax after the initial DOM -


i loading modal in page user can interact with.

var global_id=$(this).data('global-id'); var other_global_id=$(this).data('other-global-id'); var comment=$('#pairing-comment').val();  // <- not working!!! 

but i'm not sure how access properly. i've tried scoping maybe can't done although think can me. here console:

enter image description here

so happening in response user event it's happening later.

$(document).on('click','#comment-submit', function(){     arc_eh.event_handler.submit_pairing_comment.call(this);   }); 

this isn't scope, it's fact when try assign variable, $('#pairing-comment') element doesn't have value yet.

you should assign variable in success function of ajax call make sure value ready.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -