TIL 내일배움캠프-AI 1일차

박지홍·2023년 3월 14일
0

팀원 소개 프로젝트를 시작햇다.

팀원 개인의 정보가 담겨질 페이지 구현을 담당하게 되었다.

페이지 내에는
데이터 베이스에서 정보를 읽어와 이미지 및 텍스트를 처리하게 된다.
또 클릭을 하면 새로운 팝업창을 생성하여 팀원의 디테일한 정보를 호출하게 될것이다.

페이지를 읽어오는 것은 data 부분에 id값을 첨부하여
db에서 id로 색인 작업을 하여 id에 맞는 정보를 받아오게 할 예정이다.

opener 함수를 이용하여 상속 창을 관리할 예정이다.

var hz = window.open("", "hz", "width=200,height=100");
hz.opener.document.write("

opener창

");

function openerReload(){

opener.location.reload();

window.close();

}

function ajaxPostTest(){
console.log("load")
let test = {"user_id":"TTT",
"test2":"test@"}
$.ajax({
type:'POST',
contentType: 'json',
url:'/create',
data:JSON.stringify(test),
dataType: 'text',
success: function(response){
console.log(response)
},
error : function(xtr, status, error){
alert(xtr +":"+status+":"+error);
}
});
}

@app.route("/create", methods=['POST'])
def create():
data = json.loads(request.data)
return data

==============================================================

function ajaxGetTest(_id){
$.ajax({
type:'GET',
url:'/getlist',
data: {'id' : ${_id}},
dataType: 'json',
success: function(response){
console.log(response)
},
error : function(xtr, status, error){
alert(xtr +":"+status+":"+error);
}
});
}

@app.route('/getlist')
def getlist():
val = request.values
cmp = val.get('value1')
namelist = list(db.Prjmovie.find({'name':cmp},{'_id':False}))
return jsonify(namelist)

0개의 댓글