How to get the value? returned by ajax correctly

<select name="PROVINCE" id="PROVINCE" onchange="change2(this.value)">//0  

  <option value="">------</option>
</select>


------------------------------------------------------
function change2(a){
          console.log(""+a);//value0
          $.ajax({
              url:"fpry/select4j.do",
              type: "GET",
              data:{cxzdm:a,cd:"2"},              
              success: function(data){
                //var v=JSON.parse(data);
                //alert(v);
                var p= $("-sharpCITY");
                p.html("<option>------</option>");
                for (var i = 0; i < data.length; iPP) {
            
                    p.html(p.html()+"<option value=""+data[i].sjID+"">"+data[i].mc+"</option>");
        } 
     }
      
        }
                ); 
     }
Mar.19,2021

this points to the question


Ajax's successful callback input parameter, which is returned by the call on the server. Take a look at data's data hierarchy, chrome console


directly pass this into change2. https://www.qqwenda.com

Menu