开发者

Jeditable Callback function and variable scope

In my page I have the following code

$('.admission-state', nodes[a]).edita开发者_StackOverflow社区ble(function(value, settings){
    window.output = '';
    $.post("{% url admissions_ajax_admission_state %}", 
    {id:$(this).attr('id'), value:value}, 
    function(data){window.output = data;}); 
        return window.output;
    }, 
    {
        loadurl: "{% url admissions_ajax_admission_state %}",
        type : "select",
        style : "inherit",
        submit : "OK",
        onblur : "ignore",
    }
     );

My issue is that in the callback function for the $.post I set window.output = data. This does not work. There must be a scope issue. At first I set var output = ''; then set it in the callback function. I eventually moved onto using window.output. This still doesn't work.

I would like to know how to set a variable in the callback that I can use to return in my .editable call, I would also like to know why the window.output or output set as var above isn't in global scope?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜