i've tried to display data from jquery post, but it show nothing...
here is my code
index.html
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$(document).mousemove(function(){
sendValue("notif");
});
});
function sendValue(str){
$.post("ajax.php", { sendToValue: str },
function(data){
$('#display').html(data.returnFromValue);
}, "json");
}
</script>
<label for="txtValue">Enter a value : </label><input type="text" name="txtValue" value="" id="txtValue">
<div id="display"></div>
ajax.php
if (isset($_POST['sendToValue'])){
$value = $_POST['sendToValue'];
}else{
$value = "";
}
echo json_encode(array("returnFromValue"=>"This is returned from PHP : ".$value));
from this coding should be appear:
This is returned from PHP : notif
but nothing appear.
im using google chrome
This post has been edited by leixnt: 26 October 2012 - 05:20 AM

New Topic/Question
Reply


MultiQuote


|