Buradaki örneğimizde GET yöntemiyle yaptığımız işlemin daha kolay ve daha güvenli POST yöntemi örneği.
Kod örneğimiz bu şekilde;
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Yahoo Connection Manager - GET Örneği</title>
<script type="text/javascript" src="yui/build/yahoo/yahoo.js"></script>
<script type="text/javascript" src="yui/build/event/event.js"></script>
<script type="text/javascript" src="yui/build/connection/connection.js"></script>
<script type="text/javascript">
//< ![CDATA[
function sendRequest(){
var oForm = document.forms[0];
var oCallback = {
success: function (oResponse) {
saveResult(oResponse.responseText);
},
failure: function (oResponse) {
saveResult("Bir hata meydana geldi: " + oResponse.statusText);
}
};
YAHOO.util.Connect.setForm(oForm)
YAHOO.util.Connect.asyncRequest("POST",oForm.action,oCallback);
}
function saveResult(sMessage){
var musteriBilgileri = document.getElementById("musteriBilgileri");
musteriBilgileri.innerHTML = "İşlem Tamamlandı:" + sMessage;
}
//]]>
</script>
</head>
<body>
<form method="post" action="testpage.php" onsubmit="sendRequest(); return false">
<p>Bilgi elde etmek için ID numarası girin:</p>
<p>Müşteri ID'si: <input type="text" name="veri" value="" /></p>
<p><input type="submit" value="Müşteri Bilgilerini Al" /></p>
</form>
<div id="musteriBilgileri"></div>
</body>
</html>
