我想使用Web绑定下拉列表。我想在load上调用我的方法,创建函数来做同样的事情,但在浏览器中调试时它显示Uncaught Reference Error: "
GetDataContainer" is not Defined
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"> </script>
<script>
$(document).ready(GetDataContainer);
</script>
<script type="text/javascript">
function GetDataContainer() {
var params = { UserId: 'approver01', WorkflowTypeCode: 4 };
$.ajax({
type: "POST",
data: JSON.stringify(params),
contentType: "application/json; charset=utf-8",
url: 'http://IPAddress/Service.svc/getdata/MyMethodName',
dataType: "json",
async: true,
success: BindDataContainer,
error: OnErrorCall
});
}
我哪里做错了?
发布于 2020-09-15 09:15:38
将它们放在同一个脚本块中!
<script type="text/javascript">
$(document).ready(GetDataContainer);
function GetDataContainer() {
var params = { UserId: 'approver01', WorkflowTypeCode: 4 };
$.ajax({
type: "POST",
data: JSON.stringify(params),
contentType: "application/json; charset=utf-8",
url: 'http://IPAddress/Service.svc/getdata/MyMethodName',
dataType: "json",
async: true,
success: BindDataContainer,
error: OnErrorCall
});
}
https://stackoverflow.com/questions/63898644
复制