Javascript-函数循环运行

我正在尝试在脚本中调用函数,并且应该在单击按钮后运行。代码如下所示。此代码将调用另一个PEGA API。但是,当运行以下代码时,我可以看到控制台无限期地打印“运行”。知道为什么会这样吗?

<html>
<head>
<title>Sample "Hello, World" Application</title>
<script>

function setMashupName() {
console.log("Run");
pega.web.api.doAction("PegaGadget","setGadgetData","pyWorkPage.FormDetails.RequestDetails","v1111",{callback:callBackForSetVendorID});
}

function callBackForSetVendorID(value){
//returns true/false. 
  console.log("status for setVendorID: " + value);  
}
/*  function setMashupName() {
console.log("I am in");
pega.web.api.doAction("PegaGadget","setGadgetData","pyWorkPage.FormDetails.FormName","BankAccountOpen",{callback:callBackForSetVendorID});
}

function callBackForSetVendorID(value){
  console.log("status for setVendorID: " + value);  
}*/
</script>
</head>
<body bgcolor=white>

<input type="button" value="Set class on Gadget A and load Gadget B " onclick="setMashupName()"/>&nbsp &nbsp &nbsp

<table border="0">
<tr>
<td>
<img src="images/tomcat.gif">
</td>
<td>
<h1>Sample "Hello, World" Application</h1>
<p>This is the home page for a sample application used to illustrate the
source directory organization of a web application utilizing the principles
outlined in the Application Developer's Guide.
</td>
</tr>
</table>

<p>To prove that they work, you can execute either of the following links:
<ul>
<li>To a <a href="hello.jsp">JSP page</a>.
<li>To a <a href="hello">servlet</a>.
</ul>

</body>
</html>