T

질문~

클라이언트 측에서 GET으로 요청해서 서버에서 처리할수 있는방법없나요?

아무리 구글링해도.,. 클라이언트에서 전송한 get변수를 받을수 있는 방법이 없네요...
|

댓글 3개

express.js 에서 req 부분을 처리하시면 됩니다.
express.js 가 node에서 http를 쉽게 처리할수 있도록 해주는 라이브러리입니다.
app.get("/page/", function(req, res) {
console.log('request userid : ' + req.params.userid);
}
대충 이런식
아... 전송방식을 바꿔야하나보군요...
현제 전송방식은
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=euc-kr" />
<title>Ajax Test</title>
<script language="Javascript">
/*http://blog.naver.com/ctlim2?Redirect=Log&logNo=50044001483*/
/**
* Ajax Call
* @param strURL : call cgi
* @param strFunction : callBack Function
* @param strArgument : argument
*/
function xmlhttpPost(strURL, strArgument, callFunction) {

var xmlHttpReq = false;
var self = this;
// Mozilla/Safari
if(window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
// IE
else if(window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}

self.xmlHttpReq.open('GET', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
self.xmlHttpReq.onreadystatechange = function() {
if(self.xmlHttpReq.readyState == 0) { // 아직 초기화 안됨
}
else if(self.xmlHttpReq.readyState == 1) { // 읽는 중
}
else if(self.xmlHttpReq.readyState == 2) { // 읽기 완료
}
else if(self.xmlHttpReq.readyState == 3) { // 작업 중
}
else if(self.xmlHttpReq.readyState == 4) { // 작업완료
callFunction(self.xmlHttpReq);
}
}

self.xmlHttpReq.send(strArgument);
}
/**
* callBack Json
*/
function callBackJson(in_Data){

// JSON 일 때
var arrayDoc = in_Data.responseText;
eval("var jsonData ="+arrayDoc);
//var text = jsonData['id'];

//document.getElementById("result").innerHTML = text;
document.getElementById("result").innerHTML = in_Data.responseText
}
/**
* Ajax Json을 호출 한다.
*/
function callJson()
{
var form = document.forms['f1'];

var id = form.id.value;
var a = form.a.value;
var b = form.b.value;

var id = encodeURIComponent(id);
var a = encodeURIComponent(a);
var b = encodeURIComponent(b);

xmlhttpPost('http://terrorboy.net:40000', "id="+id+"&a="+a+"&b="+b, callBackJson);
}

</script>
</head>
<body>
<form name="f1" accept-charset="">
id: <input id="id" name="id" type="text" value="id" /> <br />
a: <input id="a" name="a" type="text" value="a" /> <br />
b: <input id="b" name="b" type="text" value="b" /> <br />
<input value="Json" type="button" onclick="JavaScript:callJson()" />

<div id="result"></div>
</form>
</body>
</html>

입니다 ㅎㅎ
http://stackoverflow.com/questions/6866751/how-to-combine-two-node-js-app-server-together
댓글을 작성하시려면 로그인이 필요합니다. 로그인

프로그램

+
제목 글쓴이 날짜 조회
14년 전 조회 931
14년 전 조회 1,643
14년 전 조회 2,746
14년 전 조회 1,999
14년 전 조회 2,061
14년 전 조회 1,460
14년 전 조회 1,273
14년 전 조회 1,175
14년 전 조회 950
14년 전 조회 421
14년 전 조회 1,332
14년 전 조회 4,436
14년 전 조회 1,309
14년 전 조회 1,075
14년 전 조회 571
14년 전 조회 802
14년 전 조회 625
14년 전 조회 505
14년 전 조회 588
14년 전 조회 570
14년 전 조회 510
14년 전 조회 1,384
14년 전 조회 705
14년 전 조회 561
14년 전 조회 535
14년 전 조회 595
14년 전 조회 887
14년 전 조회 792
14년 전 조회 1,377
14년 전 조회 999
14년 전 조회 3,457
14년 전 조회 673
14년 전 조회 1,230
14년 전 조회 964
14년 전 조회 2,704
14년 전 조회 2,312
14년 전 조회 519
14년 전 조회 1,579
14년 전 조회 527
14년 전 조회 2,325
14년 전 조회 1,866
14년 전 조회 484
14년 전 조회 5,567
14년 전 조회 837
14년 전 조회 1,346
14년 전 조회 1,165
14년 전 조회 1,207
14년 전 조회 1,086
14년 전 조회 1,086
14년 전 조회 917
14년 전 조회 1,272
14년 전 조회 1,661
14년 전 조회 679
14년 전 조회 1,056
14년 전 조회 2,093
14년 전 조회 1,945
14년 전 조회 899
14년 전 조회 1,395
14년 전 조회 3,881
14년 전 조회 619
14년 전 조회 2,604
14년 전 조회 1,378
14년 전 조회 1,814
14년 전 조회 1,028
14년 전 조회 800
14년 전 조회 796
14년 전 조회 943
14년 전 조회 1,015
14년 전 조회 1,900
14년 전 조회 3,150
14년 전 조회 2,197
14년 전 조회 906
14년 전 조회 1,519
14년 전 조회 1,759
14년 전 조회 562
14년 전 조회 1,804
14년 전 조회 3,040
14년 전 조회 1,721
14년 전 조회 2,658
14년 전 조회 3,967
14년 전 조회 3,999
14년 전 조회 2,409
14년 전 조회 847
14년 전 조회 1,138
14년 전 조회 3,961
14년 전 조회 2,279
14년 전 조회 1,430
14년 전 조회 3,799
14년 전 조회 2,475
14년 전 조회 558
14년 전 조회 2,464
14년 전 조회 610
14년 전 조회 841
14년 전 조회 1,680
14년 전 조회 1,302
14년 전 조회 1,558
14년 전 조회 1,118
14년 전 조회 2,116
14년 전 조회 792
14년 전 조회 801
🐛 버그신고