Prototype을 사용한 Ajax
window.onload = handleEvent;
function handleEvent() {
$('comment').observe('click',replyValidate);//success
$('commentForm').observe('submit',submitReply);//success...but....
}
function submitReply(event) { //fail
var url = '/comment.do';
new Ajax.Request(
url,
{//ajax.option
parameters: $('commentForm').serialize(true),//transport parameter
//ajax.callback
onSuccess: function(transport){
$('comment_load_area').innerHTML = transport.responseText;
},
onFailure: function() {
alert("전송에 실패하였습니다.");
}
}
);//Ajax.Request
Event.stop(event);//리소스 전송 차단
}
안된다.
대충 감이 온다.
왜 안되는지를...
window.onload = handleEvent;
function handleEvent() {
$('comment').observe('click',replyValidate);//success
$('commentForm').observe('submit',submitReply);//success...but....
}
function submitReply(event) { //fail
var url = '/comment.do';
new Ajax.Request(
url,
{//ajax.option
parameters: $('commentForm').serialize(true),//transport parameter
//ajax.callback
onSuccess: function(transport){
$('comment_load_area').innerHTML = transport.responseText;
},
onFailure: function() {
alert("전송에 실패하였습니다.");
}
}
);//Ajax.Request
Event.stop(event);//리소스 전송 차단
}
안된다.
대충 감이 온다.
왜 안되는지를...