Nodejs ejs页面接收服务器返回信息的两种方式

第一种:
1,路由:
res.render("yjtz", {msg:msgstr1,data:datastr1});
2.ejs页面
<%=msg%> <%=data%>

第二种、
使用ajax
$.ajax({
url:
OL_Action_Root+'/upload/imgxxvideo/'+id, //路由
type: 'POST',
data: formData,
async : false,//是否异步请求
cache: false,
contentType: false,
processData: false,
success: function(data){

		if (data.err==0) {
		            
		      document.getElementById("status").innerHTML = "<span style='color:#EF0000'>"+data.msg+"</span>"
			}
			 
             }
  },
      ....
原文地址:https://www.cnblogs.com/realhope/p/14954614.html