반응형
ajax 간단한 예제
Parameter를 직접 넘기기
$.ajax({
type: "POST",
dataType: "text",
url: "/action.asp",
data: { mode : "INSERT" , name: val.value},
success: function(data){
if (data == "OK")
{
val.value = "";
}
}
,error: function(){ alert(" html Load error!!"); }
});
Form submit 하기
$.ajax({
type: "POST",
dataType: "text",
url: "/action.asp",
data: $("#form_id").serialize(),
success: function(data){
if (data == "OK")
{
val.value = "";
}
}
,error: function(){ alert(" html Load error!!"); }
});
반응형