yolla.htm
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
var nesne ;
if(navigator.appName.search('Microsoft')>-1) { nesne = new ActiveXObject('MSXML2.XMLHTTP'); }
else { nesne = new XMLHttpRequest(); }
function yolla() {
nesne.open('get', 'bilgi.txt', true);
nesne.onreadystatechange= cevap;
nesne.send(null);
}
function cevap() {
if(nesne.readyState==4) {
var el = document.getElementById('bilgi');
el.innerHTML = nesne.responseText;
}
}
</script>
</head>
<body>
<input type="button" value="bilgi.txt dosyadaki yazıyı buraya al" onclick="yolla()">
<div id="bilgi"></div>
</body>
</html>
bilgi.txt
5
I clicked the button, it is writing “5” in div
The code I wanted: I clicked the button, it is writing “87” in bilgi.txt
How can I do this?
using jquery
I clicked <a… , it is writing 5 in div
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jQuery ve AJAX işlemleri</title>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
// http://www.eburhan.com/jquery-ve-ajax-islemleri/
// http://www.eburhan.com/wp-content/ekler/91/ornek_1A.php
$(document).ready(function(){
$('a').click( sonucAl );
});
function sonucAl()
{
$('#sonuc').html('hesaplanıyor...');
$.ajax({
type: 'GET',
url: 'bilgi.txt',
data: 'url=""',
success: function(sonuc) {
$('#sonuc').html(sonuc);
}
});
return false;
}
</script>
<style type="text/css">
a{
text-decoration:none;
font: normal 13px "Trebuchet MS";
color: #333
}
a:hover { color:#FF0000 }
div {
border: 1px solid #CCCCCC;
background:#FFFFCC;
color:#666;
font: normal 13px "Trebuchet MS";
width: 350px;
padding: 10px
}
</style>
</head>
<body>
<a href="http://www.google.com/search?hl=en&q=link%3Awww.eburhan.com">eburhan.com'un backlink sayısını hesaplamak için tıklayın...</a>
<br />
<br />
<div id="sonuc">sonuç buradan gözükecek...</div>
</body>
</html>
The code I wanted: I clicked the button, it is writing a text in bilgi.txt