[jquery] ajax 사용 예시

|

-----------------------------------------------------------------

a.php

-----------------------------------------------------------------

<script>

var url = "./b.php";

$.ajax({

url:url,

data:{

name:$('input:text[name=name]').val(),

script:$('input:text[name=script]').val()

},

type:"POST",

success:function(response){

if(response == "1"){

alert("저장되었습니다.");

window.history.back(-1);

}

}


});

</script>

-----------------------------------------------------------------

b.php

-----------------------------------------------------------------

$_REQUEST['name'];    //    post로 넘어온 값 확인.

$_REQUEST['script'];

echo "1";

And