jQuery HOW TO?? pass additional parameters to success callback for $.ajax call?

后端 未结 5 1368
清歌不尽
清歌不尽 2020-12-13 15:03

I am trying, in vain it seems, to be able to pass additional parameters back to the success callback method that I have created for a successful ajax call. A little backgro

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 15:32

    Updated: If you're using jQuery 1.4 use this to simplify things a bit:

    success: jQuery.proxy(function (data) {
        var select = $j(this);
        select.empty();
        $j(data).each(function() {
            var theValue = $j(this)[0]["@value"];
            var theId = $j(this)[0]["@name"];
            select.append("");
        });
        select.children(":first").attr("selected", true);
    }, selectBox)
    

提交回复
热议问题