I cannot load data via ajax
I cannot load data via ajax
jemz
Posts: 131Questions: 40Answers: 1
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ajax Demo</title>
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/plug-ins/725b2a2115b/integration/bootstrap/3/dataTables.bootstrap.css">
<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/plug-ins/725b2a2115b/integration/bootstrap/3/dataTables.bootstrap.js"></script
<script type="text/javascript">
$(function(){
$('#example').dataTable( {
"processing": true,
"serverSide": true,
"ajax": "querydata.php",
"deferLoading": 57
} );
});
</script>
</head>
<body>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Username Name</th>
<th>Password</th>
</tr>
</thead>
</body>
</html>
include_once 'config.php';
$result = mysql_query("select * from user");
while($row=mysql_fetch_array($result,MYSQL_BOTH)){
$username[] = $row['username'];
$password[] = $row['password'];
}
$data = array('username'=>$username,
'password'=>$password);
echo json_encode($data);
[/php]
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
So what happens? Error messages? Console info?
I solved it now it's the JS that causes error,In my ajax I change it to this
Thank you for the reply