Js page error

problem description

js page error

the environmental background of the problems and what methods you have tried

this is a new editing page. The springMvc, used to return ModelAndView, did not return data, so it was wrong. I wanted to judge whether it was already false, or there was a problem with the error

.

related codes

< script type= "text/javascript" >

$(function () {

$("-sharpitemTypeId").change(function() {
    var itemTypeId = $(this).val();
    $.doRequest("/present/getGoods.do",{
        "itemType": itemTypeId            
      },function(result) {
          if(result.resultCode == "SUCCESS"){
              var optData = result.model;
              $("-sharpgoodsId").html("");
              var optHtml = "";
              if(optData && optData.length > 0) {
                  for(var index in optData) {
                      var opt = optData[index];
                      var goodsId=0;
                      if(${not empty dbData}){
                          goodsId=${dbData.goodsId};//
                      }
                      if(opt.id==goodsId){
                          optHtml += "<option value=""+ opt.id +"" selected="selected" >"+ opt.name +"</option>";
                      }else{
                          optHtml += "<option value=""+ opt.id +"">"+ opt.name +"</option>";
                      }
                  }
              }else {
                  optHtml = "<option value=""></option>";
              }
              $(optHtml).appendTo($("-sharpgoodsId"));
          } else {
              alert(result.resultMsg);
          }
      });
});

});

what result do you expect? What is the error message actually seen?

clipboard.png

Aug.12,2021

errors are obvious, syntax errors


goodsId=${dbData.goodsId};

I think you are using a tag library similar to EL; syntax error
changed to:

//${dbData.goodsId}
goodsId = '${dbData.goodsId}';

if(${not empty dbData}){
  goodsId=${dbData.goodsId};//
}

can you explain what this ${not empty dbData} and ${dbData.goodsId} mean? I have never seen jquery have this syntax

Menu