$(document).ready(function() {
$("button").click(getir);
});
function getir() {
$.ajax({
dataType: "json",
url:"get.php",
success: function(datacall) {
$.each(datacall,function(index,vals) {
$("span").append(index + " : " + vals + "<br />");
});
}
});
}
the json data is {“sez”:”soze”,”koz”:”koze”}
but i get a result like:
sez : soze
koz : koze
sez : soze
koz : koze
i couldnt get why its repeated 2 times?
do you by chance have 2 spans on top of each other?
your function works fine: see this fiddle:
http://jsfiddle.net/G2ntr/
so, either your data doesn’t look like what you say it looks like, or you’ve got more then one span in your html.