jQuery Load - Additional Parameter

断了今生、忘了曾经 提交于 2021-01-29 16:10:47

问题


I am using the jQuery Load method.

 $('#tabs-1').load("@Html.Raw(Url.Action("IndexTpUse",
                                    "Transactions"))", completed);

 function completed(response, status, xhr)
 {

 }

What I need is to send an additional parameter from the load method into the completed function. Is it possible?

So that my final result might be something like this:

 function completed(response, status, xhr, additionalParam)
 {

 }

Thanks


回答1:


You can use bind to predefine some function parameters:

$('#tabs-1').load("@Html.Raw(Url.Action("IndexTpUse","Transactions"))", completed.bind(null, 'my param value'));

 function completed(additionalParam, response, status, xhr)
 {

 }


来源:https://stackoverflow.com/questions/21026844/jquery-load-additional-parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!