How to access Spring MVC model object in javascript file?

前端 未结 8 1131
南方客
南方客 2020-12-28 19:05

I am using spring 3 MVC and i have below classes.

External system would call my application using below URL:

http://somehost/root/param1/param2/param         


        
8条回答
  •  [愿得一人]
    2020-12-28 19:18

    in controller:

    JSONObject jsonobject=new JSONObject();
    jsonobject.put("error","Invalid username");
    response.getWriter().write(jsonobject.toString());
    

    in javascript:

    f(data!=success){
    
    
    
     var errorMessage=jQuery.parseJson(data);
      alert(errorMessage.error);
    }
    

提交回复
热议问题