How can I pass a parameter to a setTimeout() callback?

前端 未结 28 1905
既然无缘
既然无缘 2020-11-21 07:31

I have some JavaScript code that looks like:

function statechangedPostQuestion()
{
  //alert("statechangedPostQuestion");
  if (xmlhttp.readyState==         


        
28条回答
  •  北恋
    北恋 (楼主)
    2020-11-21 08:12

    You have to remove quotes from your setTimeOut function call like this:

    setTimeout(postinsql(topicId),4000);
    

提交回复
热议问题