What context is the jQuery.post callback function invoked in?

前端 未结 4 1656
清酒与你
清酒与你 2020-12-31 22:12

Lets say for example:

$(\".button\").click(function() {

    $.post(\"commandrunner.php\",
        {
            param1: \'value\',
            param2: \'val         


        
4条回答
  •  北海茫月
    2020-12-31 22:40

    The keyword "this" is bound to the scope of a function. To reference other parent scopes you need to store the reference in appropriate scoping variables, such as var parentScope = this;

提交回复
热议问题