Getting output of PHP script using JQuery -
i trying load output of php script using javascript , jquery. javascript function using uses $.get function in jquery call php script, want display in division. script wrote is:
<script type="text/javascript"> function on_load() { $(document).ready(function() { alert('here'); $.get("http://localhost/dbtest.php", function(data){ alert('here too'); $("uname").html(data); }); }); } </script>
the php script (dbtest.php) uses simple echo statement:
echo "hello, world!!!";
i getting first alert here, not second. can doing wrong here?
i suppose uname
id, in case should use:
$("#uname").html(data);
you can add php debugging:
error_reporting(e_all ^ e_notice); ini_set("display_errors", 1);
try remove http://
ajax call , use relative path instead.
Comments
Post a Comment